function smartqueue_taxonomy_nodequeue_form in Nodequeue 7.3
Same name and namespace in other branches
- 5.2 smartqueue.module \smartqueue_taxonomy_nodequeue_form()
- 6.2 smartqueue.module \smartqueue_taxonomy_nodequeue_form()
- 7.2 modules/smartqueue/smartqueue.module \smartqueue_taxonomy_nodequeue_form()
Implements hook_nodequeue_form().
File
- ./
smartqueue.module, line 16
Code
function smartqueue_taxonomy_nodequeue_form($queue, &$form) {
// Load data about taxonomy_term_reference fields.
$options = array();
$fields = field_info_fields();
foreach ($fields as $field_name => $field) {
if ($field['type'] == 'taxonomy_term_reference') {
$options[$field_name] = t('Field %field-name, selecting terms from vocabulary %vocabulary.', array(
'%field-name' => $field_name,
'%vocabulary' => $field['settings']['allowed_values'][0]['vocabulary'],
));
}
}
$form['placeholder']['taxonomy_fields'] = array(
'#type' => 'checkboxes',
'#title' => t('Taxonomy fields'),
'#description' => t('Select which taxonomy term reference fields to use; each unique combination of terms from all of these fields will have a subqueue.'),
'#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.'),
);
// Fields can be selected just when creating new taxonomy smartqueue.
// Disable it after that.
if (!$queue->new) {
$form['placeholder']['taxonomy_fields']['#disabled'] = TRUE;
$form['placeholder']['taxonomy_fields']['#default_value'] = explode('-', $queue->reference);
}
}