function _editor_get_file_uuids_by_field
Same name and namespace in other branches
- 10 core/modules/editor/editor.module \_editor_get_file_uuids_by_field()
- 9 core/modules/editor/editor.module \_editor_get_file_uuids_by_field()
- 8.9.x core/modules/editor/editor.module \_editor_get_file_uuids_by_field()
Finds all files referenced (data-entity-uuid) by formatted text fields.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: An entity whose fields to analyze.
Return value
array An array of file entity UUIDs.
Deprecated
in drupal:11.4.0 and is removed from drupal:12.0.0. No replacement is provided.
See also
https://www.drupal.org/node/3568136
File
-
core/
modules/ editor/ editor.module, line 197
Code
function _editor_get_file_uuids_by_field(EntityInterface $entity) : array {
@trigger_error(__FUNCTION__ . '() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. No replacement is provided. See https://www.drupal.org/node/3568136', E_USER_DEPRECATED);
$uuids = [];
$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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.