You are here

function message_notify_field_attach_create_bundle in Message Notify 7.2

Implements hook_field_attach_create_bundle().

We cannot easily set the the visibilty of extra fields, so we set the bundle settings upon creation of new message bundle.

File

./message_notify.module, line 99
Message notify.

Code

function message_notify_field_attach_create_bundle($entity_type, $bundle) {
  if ($entity_type != 'message') {
    return;
  }
  $bundle_settings = field_bundle_settings('message', $bundle);
  $display =& $bundle_settings['extra_fields']['display'];
  $visible = array(
    'visible' => TRUE,
    'weight' => 0,
  );
  $hidden = array(
    'visible' => FALSE,
    'weight' => 0,
  );
  $display['message__message_text__0'] = array(
    'message_notify_email_subject' => $visible,
    'message_notify_email_body' => $hidden,
  );
  $display['message__message_text__1'] = array(
    'message_notify_email_subject' => $hidden,
    'message_notify_email_body' => $visible,
  );
  field_bundle_settings('message', $bundle, $bundle_settings);
}