You are here

function nicemessages_install in Nice messages 7

Same name and namespace in other branches
  1. 7.2 nicemessages.install \nicemessages_install()

Implements hook_install();

File

./nicemessages.install, line 11
Module install file. Attaching boolean nicemessages_enabled field to user objects.

Code

function nicemessages_install() {

  // Clear the field cache to be sure the new field type is available.
  field_cache_clear();
  $field = array(
    'field_name' => NICEMESSAGES_FIELDNAME,
    'type' => 'list_boolean',
    'settings' => array(
      'allowed_values' => array(
        1 => t('Yes'),
        0 => t('No'),
      ),
      'default_value' => 0,
    ),
  );
  field_create_field($field);
  $instance = array(
    'field_name' => NICEMESSAGES_FIELDNAME,
    'entity_type' => 'user',
    'bundle' => 'user',
    'label' => t('Display messages in popups.'),
    'required' => false,
    'widget' => array(
      'type' => 'options_select',
    ),
  );
  field_create_instance($instance);
}