function FieldDefinitionInterface::getDisplayOptions
Same name in other branches
- 9 core/lib/Drupal/Core/Field/FieldDefinitionInterface.php \Drupal\Core\Field\FieldDefinitionInterface::getDisplayOptions()
- 10 core/lib/Drupal/Core/Field/FieldDefinitionInterface.php \Drupal\Core\Field\FieldDefinitionInterface::getDisplayOptions()
- 11.x core/lib/Drupal/Core/Field/FieldDefinitionInterface.php \Drupal\Core\Field\FieldDefinitionInterface::getDisplayOptions()
Returns the default display options for the field.
If the field's display is configurable, the returned display options act as default values and may be overridden via the respective entity display. Otherwise, the display options will be applied to entity displays as is.
Parameters
string $display_context: The display context. Either 'view' or 'form'.
Return value
array|null The array of display options for the field, or NULL if the field is not displayed. The following key/value pairs may be present:
- label: (string) Position of the field label. The default 'field' theme implementation supports the values 'inline', 'above' and 'hidden'. Defaults to 'above'. Only applies to 'view' context.
- region: (string) The region the field is in, or 'hidden'. If not specified, the default region will be used.
- type: (string) The plugin (widget or formatter depending on $display_context) to use. If not specified or if the requested plugin is unknown, the 'default_widget' / 'default_formatter' for the field type will be used. Previously 'hidden' was a valid value, it is now deprecated in favor of specifying 'region' => 'hidden'.
- settings: (array) Settings for the plugin specified above. The default settings for the plugin will be used for settings left unspecified.
- third_party_settings: (array) Settings provided by other extensions through hook_field_formatter_third_party_settings_form().
- weight: (float) The weight of the element. Not needed if 'type' is 'hidden'.
The defaults of the various display options above get applied by the used entity display.
See also
\Drupal\Core\Entity\Display\EntityDisplayInterface
4 methods override FieldDefinitionInterface::getDisplayOptions()
- BaseFieldDefinition::getDisplayOptions in core/
lib/ Drupal/ Core/ Field/ BaseFieldDefinition.php - BaseFieldOverride::getDisplayOptions in core/
lib/ Drupal/ Core/ Field/ Entity/ BaseFieldOverride.php - FieldConfig::getDisplayOptions in core/
modules/ field/ src/ Entity/ FieldConfig.php - FieldDefinition::getDisplayOptions in core/
lib/ Drupal/ Core/ Field/ FieldDefinition.php
File
-
core/
lib/ Drupal/ Core/ Field/ FieldDefinitionInterface.php, line 158
Class
- FieldDefinitionInterface
- Defines an interface for entity field definitions.
Namespace
Drupal\Core\FieldCode
public function getDisplayOptions($display_context);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.