_editor_get_file_uuids_by_field(EntityInterface $entity)
Finds all files referenced (data-entity-uuid) by formatted text fields.
Parameters
EntityInterface $entity: An entity whose fields to analyze.
Return value
array An array of file entity UUIDs.
File
- core/modules/editor/editor.module, line 551
- Adds bindings for client-side "text editors" to text formats.
Code
function _editor_get_file_uuids_by_field(EntityInterface $entity) { $uuids = array(); $formatted_text_fields = _editor_get_formatted_text_fields($entity); foreach ($formatted_text_fields as $formatted_text_field) { $text = ''; $field_items = $entity->get($formatted_text_field); foreach ($field_items as $field_item) { $text .= $field_item->value; if ($field_item->getFieldDefinition()->getType() == 'text_with_summary') { $text .= $field_item->summary; } } $uuids[$formatted_text_field] = _editor_parse_file_uuids($text); } return $uuids; }
Please login to continue.