hook_field_extra_fields()Expose "pseudo-field" components on fieldable entities.
Field UI's 'Manage fields' page lets users re-order fields, but also non-field components. For nodes, that would be title, menu settings, or other elements exposed by contributed modules through hook_form() or hook_form_alter().
Fieldable entities or contributed modules that want to have their components supported should expose them using this hook, and use field_attach_extra_weight() to retrieve the user-defined weight when inserting the component.
hook_field_extra_fields_alter()
@todo An array of 'pseudo-field' components. The keys are the name of the element as it appears in the form structure. The values are arrays with the following key/value pairs:
modules/field/field.api.php, line 33
<?php
function hook_field_extra_fields() {
$extra = array();
if ($type = node_type_get_type($bundle)) {
if ($type->has_title) {
$extra['title'] = array(
'label' => $type->title_label,
'description' => t('Node module element.'),
'weight' => -5,
);
}
if ($bundle == 'poll' && module_exists('poll')) {
$extra['title'] = array(
'label' => t('Poll title'),
'description' => t('Poll module title.'),
'weight' => -5,
);
$extra['choice_wrapper'] = array(
'label' => t('Poll choices'),
'description' => t('Poll module choices.'),
'weight' => -4,
);
$extra['settings'] = array(
'label' => t('Poll settings'),
'description' => t('Poll module settings.'),
'weight' => -3,
);
}
}
return $extra;
}
?>