You are here

redhen_activity.install in RedHen CRM 7

File

modules/redhen_activity/redhen_activity.install
View source
<?php

/**
 * Implements hook_install().
 */
function redhen_activity_install() {

  // Create the message text field for our message type category.
  $instance = array(
    'field_name' => MESSAGE_FIELD_MESSAGE_TEXT,
    'bundle' => 'redhen_activity_message',
    '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,
      // Mark that this field can be rendered using Message::getText().
      'message_text' => TRUE,
    ),
  );
  if ($existing_instance = field_info_instance($instance['entity_type'], $instance['field_name'], $instance['bundle'])) {
    field_update_instance($instance);
  }
  else {
    field_create_instance($instance);
  }

  // Add text format if it doesn't exist.
  if (!filter_format_load('redhen_activity_message')) {
    $format = (object) array(
      'format' => 'redhen_activity_message',
      'name' => 'RedHen Activity Message',
      'weight' => 0,
      'filters' => array(
        // HTML filter.
        'filter_html' => array(
          'weight' => 1,
          'status' => 1,
        ),
      ),
    );
    filter_format_save($format);
  }
}

Functions

Namesort descending Description
redhen_activity_install Implements hook_install().