You are here

function shadowbox_form_alter in Shadowbox 6.4

Same name and namespace in other branches
  1. 6.3 shadowbox.module \shadowbox_form_alter()

Implementation of hook_form_alter().

File

./shadowbox.module, line 573
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.

Code

function shadowbox_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {
    case 'content_field_edit_form':
      if ($form['basic']['type']['#value'] == 'filefield') {
        $field_name = $form['field_name']['#value'];
        $type_name = $form['type_name']['#value'];
        $form['widget']['shadowbox_settings'] = array(
          '#type' => 'fieldset',
          '#title' => t('Shadowbox settings'),
          '#collapsible' => TRUE,
          '#collapsed' => TRUE,
          '#access' => user_access('administer shadowbox'),
          '#weight' => 10,
        );
        $form['widget']['shadowbox_settings']['title_text'] = array(
          '#type' => 'select',
          '#title' => t('Title text'),
          '#description' => t('Select the source of the title text for this content type.'),
          '#options' => array(
            0 => t('Title text'),
            1 => t('Description text'),
            2 => t('Node title'),
          ),
          '#default_value' => variable_get("shadowbox_title_text_{$type_name}_{$field_name}", 0),
        );
        $form['#submit'][] = 'shadowbox_form_alter_submit';
      }
      break;
  }
}