You are here

function _node_example_installed_fields in Examples for Developers 7

Define the fields for our content type.

This big array is factored into this function for readability.

Return value

array An associative array specifying the fields we wish to add to our new node type.

Related topics

1 call to _node_example_installed_fields()
node_example_node_type_insert in node_example/node_example.module
Implements hook_node_type_insert().

File

node_example/node_example.module, line 290
Module file for Node Example module.

Code

function _node_example_installed_fields() {
  return array(
    'node_example_color' => array(
      'field_name' => 'node_example_color',
      'cardinality' => 3,
      'type' => 'text',
      'settings' => array(
        'max_length' => 60,
      ),
    ),
    'node_example_quantity' => array(
      'field_name' => 'node_example_quantity',
      'cardinality' => 1,
      'type' => 'text',
    ),
    'node_example_image' => array(
      'field_name' => 'node_example_image',
      'type' => 'image',
      'cardinality' => 1,
    ),
  );
}