You are here

function _editor_get_formatted_text_fields in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/editor/editor.module \_editor_get_formatted_text_fields()

Determines the formatted text fields on an entity.

Parameters

\Drupal\Core\Entity\FieldableEntityInterface $entity: An entity whose fields to analyze.

Return value

array The names of the fields on this entity that support formatted text.

1 call to _editor_get_formatted_text_fields()
_editor_get_file_uuids_by_field in core/modules/editor/editor.module
Finds all files referenced (data-entity-uuid) by formatted text fields.

File

core/modules/editor/editor.module, line 486
Adds bindings for client-side "text editors" to text formats.

Code

function _editor_get_formatted_text_fields(FieldableEntityInterface $entity) {
  $field_definitions = $entity
    ->getFieldDefinitions();
  if (empty($field_definitions)) {
    return array();
  }

  // Only return formatted text fields.
  return array_keys(array_filter($field_definitions, function (FieldDefinitionInterface $definition) {
    return in_array($definition
      ->getType(), array(
      'text',
      'text_long',
      'text_with_summary',
    ), TRUE);
  }));
}