function nat_sync_form in Node Auto Term [NAT] 7
Same name and namespace in other branches
- 5 nat.module \nat_sync_form()
- 6.2 nat.admin.inc \nat_sync_form()
- 6 nat.admin.inc \nat_sync_form()
- 7.2 nat.admin.inc \nat_sync_form()
Sync the NAT table with the node table for associated vocabularies.
1 string reference to 'nat_sync_form'
- nat_menu in ./
nat.module - Implements hook_menu().
File
- ./
nat.admin.inc, line 262 - NAT module administrative forms.
Code
function nat_sync_form() {
$vocabularies = _nat_get_vocabularies();
if (empty($vocabularies)) {
drupal_set_message(t('The NAT module requires at least one vocabulary to be defined.'), 'error');
drupal_goto('admin/content/taxonomy');
}
$nat_config = _nat_variable_get();
$options = array();
foreach ($nat_config['types'] as $type => $associations) {
if (!empty($associations)) {
foreach ($associations as $vid) {
$options[$type . '|' . $vid] = t('@type ‹-› !vocabulary', array(
'@type' => $type,
'!vocabulary' => $vocabularies[$vid],
));
}
}
}
if (empty($options)) {
drupal_set_message(t('There are no vocabularies available to sync.'));
drupal_goto('admin/settings/nat');
}
$form['sync'] = array(
'#type' => 'fieldset',
'#title' => t('Sync associations'),
'#description' => t('The Sync operation will create NAT associations (and terms) for nodes (marked for NAT association) not present in the NAT table.'),
'#collapsible' => TRUE,
);
$form['sync']['vocabularies'] = array(
'#type' => 'checkboxes',
'#title' => t('Select the vocabularies to sync with associated node tables'),
'#description' => t('Any nodes not already NAT associated with the selected vocabularies will be associated.'),
'#required' => TRUE,
'#options' => $options,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Sync tables'),
);
return $form;
}