You are here

function hds_form_alter in Heartbeat 6.4

Implementation of hook_form_alter().

File

modules/hds/hds.module, line 233
Heartbeat displays module.

Code

function hds_form_alter(&$form, $form_state, $form_id) {
  if (in_array($form_id, array(
    'heartbeat_messages_add',
    'heartbeat_messages_edit',
  ))) {

    // Add a build mode on template base
    $hds_build_modes = hds_content_build_modes();
    $options = ds_get_build_modes('hds');
    $form['data']['build_mode'] = array(
      '#type' => 'select',
      '#options' => drupal_map_assoc(array_keys($options)),
      '#default_value' => isset($form_state['message']->variables['build_mode']) ? $form_state['message']->variables['build_mode'] : 'full',
      '#title' => t('Display suite build mode'),
    );
  }
  if ($form_id == 'heartbeat_activity_stream_configure') {

    // Option when you want to use build modes on message type level
    $options = array(
      'none' => t('None, Use build mode of message templates.'),
    );
    $options += ds_get_build_modes('hds');
    $form['settings']['build_mode'] = array(
      '#type' => 'select',
      '#options' => drupal_map_assoc(array_keys($options)),
      '#default_value' => isset($form_state['stream']['build_mode']) ? $form_state['stream']['build_mode'] : 'full',
      '#title' => t('Display suite build mode'),
    );
  }
}