function redhen_note_install in RedHen CRM 7
Implements hook_install().
File
- modules/
redhen_note/ redhen_note.install, line 86 - Schema and installation hooks for redhen_note module.
Code
function redhen_note_install() {
// Redhen Note Body field config.
$redhen_note_body = array(
'field_name' => 'redhen_note_body',
'type' => 'text_long',
'cardinality' => 1,
'locked' => TRUE,
);
field_create_field($redhen_note_body);
$t = get_t();
// Create body field instance for notes.
$redhen_note_body_instance = array(
'field_name' => 'redhen_note_body',
'entity_type' => 'redhen_note',
'bundle' => 'redhen_note',
'label' => $t('Message'),
'widget' => array(
'type' => 'text_textarea',
),
'settings' => array(
'text_processing' => 1,
),
);
field_create_instance($redhen_note_body_instance);
// Redhen Note Type Taxonomy field.
taxonomy_vocabulary_save((object) array(
'name' => 'Note type',
'machine_name' => 'note_type',
));
$redhen_note_type_field = array(
'field_name' => 'redhen_note_type',
'type' => 'taxonomy_term_reference',
'locked' => TRUE,
'cardinality' => 1,
'settings' => array(
'allowed_values' => array(
array(
'vocabulary' => 'note_type',
'parent' => 0,
),
),
),
);
field_create_field($redhen_note_type_field);
$redhen_note_type_field_instance = array(
'field_name' => 'redhen_note_type',
'entity_type' => 'redhen_note',
'label' => $t('Note Type'),
'bundle' => 'redhen_note',
'required' => FALSE,
'widget' => array(
'type' => 'options_select',
),
);
field_create_instance($redhen_note_type_field_instance);
}