EntityDisplayRepositoryInterface
interface EntityDisplayRepositoryInterface (View source)
Provides an interface for an entity display repository.
Constants
| DEFAULT_DISPLAY_MODE |
The default display mode ID. |
Methods
Gets the entity view mode info for all entity types.
Gets the entity view mode info for a specific entity type.
Gets the entity form mode info for all entity types.
Gets the entity form mode info for a specific entity type.
Gets an array of view mode options.
Gets an array of form mode options.
Returns an array of enabled view mode options by bundle.
Returns an array of enabled form mode options by bundle.
Clears the gathered display mode info.
Returns the entity view display associated with a bundle and view mode.
Returns the entity form display associated with a bundle and form mode.
Details
array
getAllViewModes()
Gets the entity view mode info for all entity types.
array
getViewModes(string $entity_type_id)
Gets the entity view mode info for a specific entity type.
array
getAllFormModes()
Gets the entity form mode info for all entity types.
array
getFormModes(string $entity_type_id)
Gets the entity form mode info for a specific entity type.
array
getViewModeOptions(string $entity_type_id)
Gets an array of view mode options.
array
getFormModeOptions(string $entity_type_id)
Gets an array of form mode options.
array
getViewModeOptionsByBundle(string $entity_type_id, string $bundle)
Returns an array of enabled view mode options by bundle.
array
getFormModeOptionsByBundle(string $entity_type_id, string $bundle)
Returns an array of enabled form mode options by bundle.
$this
clearDisplayModeInfo()
Clears the gathered display mode info.
EntityViewDisplayInterface
getViewDisplay(string $entity_type, string $bundle, string $view_mode = self::DEFAULT_DISPLAY_MODE)
Returns the entity view display associated with a bundle and view mode.
Use this function when assigning suggested display options for a component in a given view mode. Note that they will only be actually used at render time if the view mode itself is configured to use dedicated display settings for the bundle; if not, the 'default' display is used instead.
The function reads the entity view display from the current configuration, or returns a ready-to-use empty one if configuration entry exists yet for this bundle and view mode. This streamlines manipulation of display objects by always returning a consistent object that reflects the current state of the configuration.
Example usage:
- Set the 'body' field to be displayed and the 'field_image' field to be hidden on article nodes in the 'default' display.
EntityFormDisplayInterface
getFormDisplay(string $entity_type, string $bundle, string $form_mode = self::DEFAULT_DISPLAY_MODE)
Returns the entity form display associated with a bundle and form mode.
The function reads the entity form display object from the current configuration, or returns a ready-to-use empty one if no configuration entry exists yet for this bundle and form mode. This streamlines manipulation of entity form displays by always returning a consistent object that reflects the current state of the configuration.
Example usage:
- Set the 'body' field to be displayed with the 'text_textarea_with_summary' widget and the 'field_image' field to be hidden on article nodes in the 'default' form mode.