function expire_taxonomy_term_settings_form in Cache Expiration 7.2
Settings form for a taxonomy vocabulary.
1 call to expire_taxonomy_term_settings_form()
- expire_form_taxonomy_form_vocabulary_alter in ./
expire.module - Implements hook_form_FORM_ID_alter().
File
- ./
expire.admin.inc, line 882 - Settings forms for the Expire module.
Code
function expire_taxonomy_term_settings_form(&$form) {
if (empty($form['#vocabulary']->machine_name)) {
return;
}
$vocabulary = $form['#vocabulary']->machine_name;
$form['expire'] = array(
'#type' => 'fieldset',
'#title' => t('Cache Expiration'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
);
// TAXONOMY TERM SETTINGS.
$form['expire']['expire_taxonomy_term_override_defaults'] = array(
'#type' => 'checkbox',
'#title' => t('Override default settings for this vocabulary'),
'#default_value' => variable_get('expire_taxonomy_term_override_defaults_' . $vocabulary),
);
// Copy here settings from default settings form.
$settings_form = expire_admin_settings_form();
$form['expire']['taxonomy_term_actions'] = $settings_form['tabs']['taxonomy_term']['actions'];
$form['expire']['taxonomy_term_expires'] = $settings_form['tabs']['taxonomy_term']['expire'];
// Display fieldsets with settings only if they should be overriden.
$form['expire']['taxonomy_term_actions']['#states'] = array(
'visible' => array(
':input[name="expire_taxonomy_term_override_defaults"]' => array(
'checked' => TRUE,
),
),
);
$form['expire']['taxonomy_term_expires']['#states'] = array(
'visible' => array(
':input[name="expire_taxonomy_term_override_defaults"]' => array(
'checked' => TRUE,
),
),
);
// Change tab title to more suitable here.
$form['expire']['taxonomy_term_expires']['#title'] = t('What pages should be expired when taxonomy term action is triggered?');
// Set default settings for this vocabulary.
$form['expire']['taxonomy_term_actions']['expire_taxonomy_term_actions']['#default_value'] = variable_get('expire_taxonomy_term_actions_' . $vocabulary, array());
$form['expire']['taxonomy_term_expires']['expire_taxonomy_term_front_page']['#default_value'] = variable_get('expire_taxonomy_term_front_page_' . $vocabulary, EXPIRE_TAXONOMY_TERM_FRONT_PAGE);
$form['expire']['taxonomy_term_expires']['expire_taxonomy_term_taxonomy_term_page']['#default_value'] = variable_get('expire_taxonomy_term_taxonomy_term_page_' . $vocabulary, EXPIRE_TAXONOMY_TERM_TAXONOMY_TERM_PAGE);
if (module_exists('node_reference') || module_exists('user_reference') || module_exists('entityreference')) {
$form['expire']['taxonomy_term_expires']['expire_taxonomy_term_reference_pages']['#default_value'] = variable_get('expire_taxonomy_term_reference_pages_' . $vocabulary, EXPIRE_TAXONOMY_TERM_REFERENCE_PAGES);
if (module_exists('field_collection')) {
$form['expire']['taxonomy_term_expires']['expire_taxonomy_term_reference_field_collection_pages']['#default_value'] = variable_get('expire_taxonomy_term_reference_field_collection_pages_' . $vocabulary, EXPIRE_TAXONOMY_TERM_REFERENCE_FC_PAGES);
}
}
$form['expire']['taxonomy_term_expires']['expire_taxonomy_term_custom']['#default_value'] = variable_get('expire_taxonomy_term_custom_' . $vocabulary, EXPIRE_TAXONOMY_TERM_CUSTOM);
$form['expire']['taxonomy_term_expires']['expire_taxonomy_term_custom_pages']['#default_value'] = variable_get('expire_taxonomy_term_custom_pages_' . $vocabulary);
// Attach js.
$form['#attached']['js'][] = drupal_get_path('module', 'expire') . '/js/expire.admin.js';
}