You are here

function smartqueue_taxonomy_nodequeue_form in Nodequeue 6.2

Same name and namespace in other branches
  1. 5.2 smartqueue.module \smartqueue_taxonomy_nodequeue_form()
  2. 7.3 smartqueue.module \smartqueue_taxonomy_nodequeue_form()
  3. 7.2 modules/smartqueue/smartqueue.module \smartqueue_taxonomy_nodequeue_form()

Implementation of hook_nodequeue_form()

File

./smartqueue.module, line 16

Code

function smartqueue_taxonomy_nodequeue_form($queue, &$form) {
  foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
    $options[$vid] = check_plain($vocabulary->name);
  }
  $form['placeholder']['vocabularies'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Vocabularies'),
    '#description' => t('Select which vocabularies to use; each unique combination of terms from all of these vocabularies will have a subqueue. This selection cannot be changed after the queue is created.'),
    '#options' => $options,
  );
  $form['placeholder']['use_parents'] = array(
    '#type' => 'checkbox',
    '#title' => t('Assume parent term for hierarchical vocabs'),
    '#description' => t("Instead of using the node's terms for nodequeue assignment use the top-most parents of a term. This has no effect if there in non-hierarchical vocabularies."),
    '#default_value' => isset($queue->use_parents) ? $queue->use_parents : 0,
  );
  $form['subqueue_title'] = array(
    '#type' => 'textfield',
    '#title' => t('Subqueue title'),
    '#default_value' => $queue->subqueue_title,
    '#size' => 50,
    '#maxlength' => 64,
    '#description' => t('What to display for the subqueue title; use %subqueue to embed the actual subqueue title. This is used to distinguish multiple nodequeues with subqueues from each other, as internal subqueue title is filled automatically.'),
  );
  if (!empty($queue->qid)) {

    // Lock the vocabulary selection.
    $form['placeholder']['vocabularies']['#disabled'] = TRUE;
    $form['placeholder']['vocabularies']['#default_value'] = explode('-', $queue->reference);

    // Only show node types that are available for this queue.
    if (!empty($queue->reference)) {
      $node_types = _smartqueue_taxonomy_get_node_types($queue);
      $form['types']['#options'] = $node_types;
    }
  }
}