1 node_type_example.module | _node_type_example_installed_instances() |
Defines the field instances for our content type.
It lets Backdrop know which widget to use to allow users to enter data and how to react in different view modes. We are going to display a page that uses a custom "node_type_example_list" view mode. We will set the cardinality to three, allowing our content type to give users three color fields.
Return value
array: An associative array specifying the instances we wish to add to our new content type.
Related topics
File
- modules/
examples/ node_type_example/ node_type_example.module, line 259 - Hook implementations for the Node Type Example module.
Code
function _node_type_example_installed_instances() {
return array(
'node_type_example_color' => array(
'field_name' => 'node_type_example_color',
'label' => t('The colors available for this object.'),
'widget' => array(
'type' => 'text_textfield',
),
'display' => array(
'node_type_example_list' => array(
'label' => 'hidden',
'type' => 'node_type_example_colors',
),
),
),
'node_type_example_quantity' => array(
'field_name' => 'node_type_example_quantity',
'label' => t('Quantity required'),
'type' => 'text',
'widget' => array(
'type' => 'text_textfield',
),
'display' => array(
'node_type_example_list' => array(
'label' => 'hidden',
'type' => 'hidden',
),
),
),
'node_type_example_image' => array(
'field_name' => 'node_type_example_image',
'label' => t('Upload an image:'),
'required' => FALSE,
'widget' => array(
'type' => 'image_image',
'weight' => 2.10,
),
'display' => array(
'node_type_example_list' => array(
'label' => 'hidden',
'type' => 'image_link_content__thumbnail',
),
),
),
);
}