You are here

function message_install in Message 7

Same name and namespace in other branches
  1. 6 message.install \message_install()

Implements hook_install().

File

./message.install, line 11
Install, update, and uninstall functions for the message module.

Code

function message_install() {

  // Create the field holding the message text.
  $field = array(
    'field_name' => MESSAGE_FIELD_MESSAGE_TEXT,
    'type' => 'text_long',
    'entity_types' => array(
      'message_type',
    ),
    'cardinality' => FIELD_CARDINALITY_UNLIMITED,
    'translatable' => TRUE,
    'locked' => TRUE,
    'settings' => array(
      // Mark that this field can be rendered using Message::getText().
      'message_text' => TRUE,
    ),
  );
  $field = field_create_field($field);
  $instance = array(
    'field_name' => MESSAGE_FIELD_MESSAGE_TEXT,
    'bundle' => 'message_type',
    'entity_type' => 'message_type',
    'label' => t('Message text'),
    'description' => t('This is the text of all messages of this type.'),
    'required' => TRUE,
    'settings' => array(
      'text_processing' => 1,
    ),
  );
  field_create_instance($instance);
  variable_del('message_entity_delete_cleanup');
}