You are here

function fe_nodequeue_form_alter in Features Extra 6

Implementation of hook_form_alter().

File

./fe_nodequeue.module, line 200

Code

function fe_nodequeue_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'nodequeue_edit_queue_form' && user_access('administer features')) {
    $form['description']['#weight'] = -2;

    // Machine name.
    $table = 'fe_nodequeue_queue';
    $qid = $form['qid']['#value'];
    if (!empty($qid)) {
      $machine_name = db_result(db_query("SELECT machine_name FROM {{$table}} WHERE qid = %d", $qid));
    }
    $form['machine_name'] = array(
      '#type' => 'textfield',
      '#title' => t('Machine name'),
      '#default_value' => empty($machine_name) ? '' : $machine_name,
      '#maxlength' => 32,
      '#description' => t('Give the nodequeue a machine name to make it exportable with "!features" module.', array(
        '!features' => l('Features', 'http://drupal.org/project/features'),
      )),
      '#weight' => -1,
    );

    // Validate machine name.
    $form['#validate'][] = 'fe_nodequeue_machine_name_validate';
    $form['#submit'][] = 'fe_nodequeue_machine_name_submit';
  }
  elseif ($form_id == 'nodequeue_admin_delete') {
    $form['#submit'][] = 'fe_nodequeue_machine_name_delete';
  }
}