function metatag_bulk_revert_form in Metatag 7
Form constructor to revert nodes to their default metatags.
See also
metatag_bulk_revert_form_submit()
1 string reference to 'metatag_bulk_revert_form'
- metatag_menu in ./
metatag.module - Implements hook_menu().
File
- ./
metatag.admin.inc, line 444 - Administration page callbacks for the metatag module.
Code
function metatag_bulk_revert_form() {
// Get the list of entity:bundle options.
$options = array();
foreach (entity_get_info() as $entity_type => $entity_info) {
foreach (array_keys($entity_info['bundles']) as $bundle) {
if (metatag_entity_supports_metatags($entity_type, $bundle)) {
$options[$entity_type . ':' . $bundle] = $entity_info['label'] . ': ' . $entity_info['bundles'][$bundle]['label'];
}
}
}
$form['update'] = array(
'#type' => 'checkboxes',
'#required' => TRUE,
'#title' => t('Select the entities to revert'),
'#options' => $options,
'#default_value' => array(),
'#description' => t('All meta tags will be removed for all content of the selected entities.'),
);
$metatags = metatag_get_info();
$options = array();
foreach ($metatags['tags'] as $tag_name => $tag) {
$options[$tag_name] = t('@group_label: @tag_label', array(
'@group_label' => $metatags['groups'][$tag['group']]['label'],
'@tag_label' => $tag['label'],
));
}
if (count($options) > 0) {
$form['tags'] = array(
'#type' => 'checkboxes',
'#required' => FALSE,
'#title' => t('Select the tags to revert'),
'#description' => t('If you select any tags, only those tags will be reverted.'),
'#options' => $options,
);
}
$languages = language_list();
$options = array(
LANGUAGE_NONE => t('Language neutral'),
);
foreach ($languages as $language) {
$options[$language->language] = $language->name;
}
$form['languages'] = array(
'#type' => 'checkboxes',
'#required' => FALSE,
'#title' => t('Select the languages to revert'),
'#description' => t('If you select any languages, only tags for those languages will be reverted.'),
'#options' => $options,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Revert'),
);
return $form;
}