function entity_example_field_extra_fields
Implements hook_field_extra_fields().
This exposes the "extra fields" (usually properties that can be configured as if they were fields) of the entity as pseudo-fields so that they get handled by the Entity and Field core functionality. Node titles get treated in a similar manner.
Related topics
File
-
entity_example/
entity_example.module, line 370
Code
function entity_example_field_extra_fields() {
$form_elements['item_description'] = array(
'label' => t('Item Description'),
'description' => t('Item Description (an extra form field)'),
'weight' => -5,
);
$display_elements['created'] = array(
'label' => t('Creation date'),
'description' => t('Creation date (an extra display field)'),
'weight' => 0,
);
$display_elements['item_description'] = array(
'label' => t('Item Description'),
'description' => t('Just like title, but trying to point out that it is a separate property'),
'weight' => 0,
);
// Since we have only one bundle type, we'll just provide the extra_fields
// for it here.
$extra_fields['entity_example_basic']['first_example_bundle']['form'] = $form_elements;
$extra_fields['entity_example_basic']['first_example_bundle']['display'] = $display_elements;
return $extra_fields;
}