Loading nodequeue.module +61 −2 Original line number Diff line number Diff line Loading @@ -78,6 +78,65 @@ function nodequeue_init() { include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'nodequeue') . '/includes/nodequeue.actions.inc'; } /** * Implements hook_form_FORM_ID_alter(). * - Adds a vertical tab for nodequeue settings. */ function nodequeue_form_node_type_form_alter(&$form, &$form_state) { $form['nodequeue'] = array( '#type' => 'fieldset', '#title' => t('Queues'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', '#access' => 'administer nodequeue', ); $options = array(); $defaults = array(); $queues = nodequeue_load_queues(array_keys(nodequeue_get_all_qids())); foreach ($queues as $qid => $queue) { $options[$qid] = t($queue->title); if (in_array($form['#node_type']->type, $queue->types)) { $defaults[] = $qid; } } $form['nodequeue']['nodequeue_queues'] = array( '#type' => 'checkboxes', '#title' => t('Queues where this content type can be added'), '#options' => $options, '#default_value' => $defaults, ); // Add a submit handler. $form['#submit'][] = 'nodequeue_form_node_type_form_submit'; } /** * Submit handler for the node type form. */ function nodequeue_form_node_type_form_submit(&$form, &$form_state) { $enabled_queues = $form_state['values']['nodequeue_queues']; foreach ($enabled_queues as $qid => $enabled) { $type = $form_state['values']['type']; $queue = nodequeue_load($qid); $types = $queue->types; if ($enabled) { if (!in_array($type, $types)) { $types[] = $type; } } else { $key = array_search($type, $types); unset($types[$key]); } $queue->types = array_filter($types); $qid = nodequeue_save($queue); // sets $queue->qid if needed. } } /** * Implements hook_menu(). */ Loading Loading @@ -471,7 +530,7 @@ function nodequeue_views_api() { /** * Implements hook_form_FORM_ID_alter(). */ function nodequeue_form_apachesolr_search_bias_form_alter(&$form, &$form_state, $form_id) { function nodequeue_form_apachesolr_search_bias_form_alter(&$form, &$form_state) { // Setup for the form building. $weights = drupal_map_assoc(array('21.0', '13.0', '8.0', '5.0', '3.0', '2.0', '1.0', '0.8', '0.5', '0.3', '0.2', '0.1')); $weights['0'] = t('Normal'); Loading Loading
nodequeue.module +61 −2 Original line number Diff line number Diff line Loading @@ -78,6 +78,65 @@ function nodequeue_init() { include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'nodequeue') . '/includes/nodequeue.actions.inc'; } /** * Implements hook_form_FORM_ID_alter(). * - Adds a vertical tab for nodequeue settings. */ function nodequeue_form_node_type_form_alter(&$form, &$form_state) { $form['nodequeue'] = array( '#type' => 'fieldset', '#title' => t('Queues'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#group' => 'additional_settings', '#access' => 'administer nodequeue', ); $options = array(); $defaults = array(); $queues = nodequeue_load_queues(array_keys(nodequeue_get_all_qids())); foreach ($queues as $qid => $queue) { $options[$qid] = t($queue->title); if (in_array($form['#node_type']->type, $queue->types)) { $defaults[] = $qid; } } $form['nodequeue']['nodequeue_queues'] = array( '#type' => 'checkboxes', '#title' => t('Queues where this content type can be added'), '#options' => $options, '#default_value' => $defaults, ); // Add a submit handler. $form['#submit'][] = 'nodequeue_form_node_type_form_submit'; } /** * Submit handler for the node type form. */ function nodequeue_form_node_type_form_submit(&$form, &$form_state) { $enabled_queues = $form_state['values']['nodequeue_queues']; foreach ($enabled_queues as $qid => $enabled) { $type = $form_state['values']['type']; $queue = nodequeue_load($qid); $types = $queue->types; if ($enabled) { if (!in_array($type, $types)) { $types[] = $type; } } else { $key = array_search($type, $types); unset($types[$key]); } $queue->types = array_filter($types); $qid = nodequeue_save($queue); // sets $queue->qid if needed. } } /** * Implements hook_menu(). */ Loading Loading @@ -471,7 +530,7 @@ function nodequeue_views_api() { /** * Implements hook_form_FORM_ID_alter(). */ function nodequeue_form_apachesolr_search_bias_form_alter(&$form, &$form_state, $form_id) { function nodequeue_form_apachesolr_search_bias_form_alter(&$form, &$form_state) { // Setup for the form building. $weights = drupal_map_assoc(array('21.0', '13.0', '8.0', '5.0', '3.0', '2.0', '1.0', '0.8', '0.5', '0.3', '0.2', '0.1')); $weights['0'] = t('Normal'); Loading