function hook_field_extra_fields

cis7 field.api.php hook_field_extra_fields()
cle7 field.api.php hook_field_extra_fields()
elmsmedia7 field.api.php hook_field_extra_fields()
icor7 field.api.php hook_field_extra_fields()
meedjum_blog7 field.api.php hook_field_extra_fields()
mooc7 field.api.php hook_field_extra_fields()

Exposes "pseudo-field" components on fieldable entities.

Field UI's "Manage fields" and "Manage display" pages let users re-order fields, but also non-field components. For nodes, these include the title, poll choices, and other elements exposed by modules through hook_form() or hook_form_alter().

Fieldable entities or modules that want to have their components supported should expose them using this hook. The user-defined settings (weight, visible) are automatically applied on rendered forms and displayed entities in a #pre_render callback added by field_attach_form() and field_attach_view().

Return value

A nested array of 'pseudo-field' elements. Each list is nested within the following keys: entity type, bundle name, context (either 'form' or 'display'). The keys are the name of the elements as appearing in the renderable array (either the entity form or the displayed entity). The value is an associative array:

  • label: The human readable name of the element.
  • description: A short description of the element contents.
  • weight: The default weight of the element.
  • edit: (optional) String containing markup (normally a link) used as the element's 'edit' operation in the administration interface. Only for 'form' context.
  • delete: (optional) String containing markup (normally a link) used as the element's 'delete' operation in the administration interface. Only for 'form' context.

See also

_field_extra_fields_pre_render()

hook_field_extra_fields_alter()

Related topics

16 functions implement hook_field_extra_fields()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

accessibility_field_extra_fields in sites/all/modules/ulmus/accessibility/accessibility.module
Implements hook_field_extra_fields().
comment_field_extra_fields in modules/comment/comment.module
Implements hook_field_extra_fields().
ds_extras_field_extra_fields in sites/all/modules/ulmus/ds/modules/ds_extras/ds_extras.module
Implements hook_field_extra_fields().
ds_test_field_extra_fields in sites/all/modules/ulmus/ds/tests/ds_test.module
Implements hook_field_extra_fields().
entity_field_extra_fields in sites/all/modules/ulmus/entity/entity.module
Implements hook_field_extra_fields().

... See full list

1 invocation of hook_field_extra_fields()
FieldInfo::getBundleExtraFields in modules/field/field.info.class.inc
Retrieves the "extra fields" for a bundle.

File

modules/field/field.api.php, line 41

Code

function hook_field_extra_fields() {
  $extra['node']['poll'] = array(
    'form' => array(
      'choice_wrapper' => array(
        'label' => t('Poll choices'),
        'description' => t('Poll choices'),
        'weight' => -4,
      ),
      'settings' => array(
        'label' => t('Poll settings'),
        'description' => t('Poll module settings'),
        'weight' => -3,
      ),
    ),
    'display' => array(
      'poll_view_voting' => array(
        'label' => t('Poll vote'),
        'description' => t('Poll vote'),
        'weight' => 0,
      ),
      'poll_view_results' => array(
        'label' => t('Poll results'),
        'description' => t('Poll results'),
        'weight' => 0,
      ),
    ),
  );

  return $extra;
}