function field_info_extra_fields

Returns a list and settings of pseudo-field elements in a given bundle.

If $context is 'form', an array with the following structure:


  array(
    'name_of_pseudo_field_component' => array(
      'label' => The human readable name of the component,
      'description' => A short description of the component content,
      'weight' => The weight of the component in edit forms,
    ),
    'name_of_other_pseudo_field_component' => array(
      // ...
    ),
  );

If $context is 'display', an array with the following structure:


  array(
    'name_of_pseudo_field_component' => array(
      'label' => The human readable name of the component,
      'description' => A short description of the component content,
      // One entry per view mode, including the 'default' mode:
      'display' => array(
        'default' => array(
          'weight' => The weight of the component in displayed entities in
            this view mode,
          'visible' => TRUE if the component is visible, FALSE if hidden, in
            displayed entities in this view mode,
        ),
        'teaser' => array(
          // ...
        ),
      ),
    ),
    'name_of_other_pseudo_field_component' => array(
      // ...
    ),
  );

Parameters

$entity_type: The type of entity; e.g. 'node' or 'user'.

$bundle: The bundle name.

$context: The context for which the list of pseudo-fields is requested. Either 'form' or 'display'.

Return value

The array of pseudo-field elements in the bundle.

Related topics

5 calls to field_info_extra_fields()
DisplayOverview::buildForm in drupal/core/modules/field_ui/lib/Drupal/field_ui/DisplayOverview.php
Implements \Drupal\Core\Form\FormInterface::buildForm().
EntityDisplayBase::getComponent in drupal/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php
Gets the display options set for a component.
EntityDisplayBase::removeComponent in drupal/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php
Sets a component to be hidden.
EntityDisplayBase::setComponent in drupal/core/modules/entity/lib/Drupal/entity/EntityDisplayBase.php
Sets the display options for a component.
FieldOverview::buildForm in drupal/core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
Implements \Drupal\Core\Form\FormInterface::buildForm().

File

drupal/core/modules/field/field.info.inc, line 478
Field Info API, providing information about available fields and field types.

Code

function field_info_extra_fields($entity_type, $bundle, $context) {
  $info = Field::fieldInfo()
    ->getBundleExtraFields($entity_type, $bundle);
  return isset($info[$context]) ? $info[$context] : array();
}