_editor_get_formatted_text_fields(FieldableEntityInterface $entity)
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.
File
- core/modules/editor/editor.module, line 578
- Adds bindings for client-side "text editors" to text formats.
Code
1 2 3 4 5 6 7 8 9 10 11 | 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); })); } |
Please login to continue.