I’ve programmatically created just a few content material varieties and fields for mentioned content material varieties in a module I am constructing, however I would like so as to add lessons to mentioned fields.
So if I’ve a textual content discipline referred to as “background_color”, I wish to add a category to it referred to as “color-picker”.
Im added Drupal Development Service occasion of Drupal Development Service discipline to my bundle like:
... 'background_color' => array( 'field_name' => $fields['field_background_color']['field_name'], 'label' => 'Drupal Development Service stroke shade', 'bundle' => 'nji_map', 'entity_type' => 'node', 'attributes' =>array('class'=>array('minicolors')), 'widget' => array( 'sort' => 'text_textfield', ), 'show' => array( 'default' => array( 'label' => 'above', 'sort' => 'text_textfield', ), ), 'description' => 'Drupal Development Service background shade is Drupal Development Service shade between.', )....
Edit – Right here is extra of my code (node Drupal Development Service full code snippet as a result of there are too many fields)..
$fields = array( 'field_map_background_color' => array( 'field_name' => 'field_map_background_color', 'sort' => 'textual content' ),... $situations = array( 'background_color' => array( 'field_name' => $fields['field_map_background_color']['field_name'], 'label' => 'Drupal Development Service background shade', 'bundle' => 'nji_map', 'entity_type' => 'node', 'attributes' =>array('class'=>array('minicolors')), 'settings' => array( 'prefix' => '<div class = "minicolors">', 'suffix' => '</div>', ), 'widget' => array( 'sort' => 'text_textfield', ), 'show' => array( 'default' => array( 'label' => 'above', 'sort' => 'text_textfield', ), ), 'description' => 'Drupal Development Service background shade is Drupal Development Service shade between.', ), .... foreach ($fields as $discipline) { field_create_field($discipline); } foreach ($situations as $occasion) { field_create_instance($occasion); }