nodewords_admin.module in Nodewords: D6 Meta Tags 6.3
Same filename and directory in other branches
Administration interface for Nodewords.
File
nodewords_admin/nodewords_admin.moduleView source
<?php
/**
* @file
* Administration interface for Nodewords.
*/
/**
* Implements hook_form_FORM_ID_alter().
*/
function nodewords_admin_form_taxonomy_form_term_alter(&$form, &$form_state) {
$bool = nodewords_check_version('2.16') && !isset($form_state['confirm_delete']) && !isset($form_state['confirm_parents']);
if ($bool) {
if (!empty($form_state['values']['nodewords'])) {
$tags = $form_state['values']['nodewords'];
}
elseif (isset($form['tid']['#value']) && is_numeric($form['tid']['#value'])) {
$id = $form['tid']['#value'];
$tags = nodewords_load_tags(array(
'type' => NODEWORDS_TYPE_TERM,
'id' => $id,
));
}
else {
$tags = array();
}
$form['nodewords'] = nodewords_tags_edit_fields(array(
'type' => NODEWORDS_TYPE_TERM,
'id' => isset($id) ? $id : 0,
), $tags, array(
'fieldset' => TRUE,
));
$form['submit']['#weight'] = 45;
$form['delete']['#weight'] = 50;
}
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function nodewords_admin_form_taxonomy_form_vocabulary_alter(&$form, &$form_state) {
if (isset($form['vid']['#value'])) {
$id = $form['vid']['#value'];
if (!empty($form_state['values']['nodewords'])) {
$tags = $form_state['values']['nodewords'];
}
elseif (isset($id) && is_numeric($id)) {
$tags = nodewords_load_tags(array(
'type' => NODEWORDS_TYPE_VOCABULARY,
'id' => $id,
));
}
else {
$tags = array();
}
$form['nodewords'] = nodewords_tags_edit_fields(array(
'type' => NODEWORDS_TYPE_VOCABULARY,
'id' => $id,
), $tags, array(
'fieldset' => TRUE,
));
$form['submit']['#weight'] = 45;
$form['delete']['#weight'] = 50;
}
}
/**
* Implemenation of hook_help().
*/
function nodewords_admin_help($path, $arg) {
switch ($path) {
case 'admin/content/nodewords/meta-tags':
$output = '<p>' . t('On this page you can enter the default values for the meta tags.') . '</p>';
break;
case 'admin/content/nodewords/meta-tags/errorpage_403':
$output = '<p>' . t('On this page you can enter the meta tags for the <q>access denied</q> error page of your site.') . '</p>';
break;
case 'admin/content/nodewords/meta-tags/errorpage_404':
$output = '<p>' . t('On this page you can enter the meta tags for the <q>page not found</q> error page of your site.') . '</p>';
break;
case 'admin/content/nodewords/meta-tags/frontpage':
$output = '<p>' . t('On this page you can enter the meta tags for the front page of your site. If the front page is a node, the meta tags edit fields will not appear in the node edit form.') . '</p>';
break;
default:
$output = '';
break;
}
return $output;
}
/**
* Implements hook_menu().
*/
function nodewords_admin_menu() {
$admin_access = array(
'administer meta tags',
);
$items = array();
$items['admin/content/nodewords'] = array(
'title' => 'Meta tags',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'nodewords_admin_settings_form',
),
'description' => 'Configure HTML meta tags for all the content.',
'access arguments' => $admin_access,
'type' => MENU_NORMAL_ITEM,
'file' => 'nodewords_admin.admin.inc',
);
$items['admin/content/nodewords/settings'] = array(
'title' => 'Settings',
'access arguments' => $admin_access,
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -1,
'file' => 'nodewords_admin.admin.inc',
);
$items['admin/content/nodewords/settings/general'] = array(
'title' => 'General settings',
'access arguments' => $admin_access,
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -1,
'file' => 'nodewords_admin.admin.inc',
);
$items['admin/content/nodewords/meta-tags'] = array(
'title' => 'Specific meta tags',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'nodewords_admin_tags_edit_form',
array(
'type' => NODEWORDS_TYPE_DEFAULT,
),
),
'access arguments' => $admin_access,
'type' => MENU_LOCAL_TASK,
'file' => 'nodewords_admin.admin.inc',
);
$items['admin/content/nodewords/meta-tags/default'] = array(
'title' => 'Default meta tags',
'access arguments' => $admin_access,
'type' => MENU_DEFAULT_LOCAL_TASK,
'file' => 'nodewords_admin.admin.inc',
);
$items['admin/content/nodewords/meta-tags/errorpage_403'] = array(
'title' => 'Error 403 page',
'access arguments' => $admin_access,
'type' => MENU_LOCAL_TASK,
'file' => 'nodewords_admin.admin.inc',
);
$items['admin/content/nodewords/meta-tags/errorpage_404'] = array(
'title' => 'Error 404 page',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'nodewords_admin_tags_edit_form',
array(
'type' => NODEWORDS_TYPE_ERRORPAGE,
'id' => 404,
),
),
'access arguments' => $admin_access,
'type' => MENU_LOCAL_TASK,
'file' => 'nodewords_admin.admin.inc',
);
return $items;
}
/**
* Implements hook_theme().
*/
function nodewords_admin_theme() {
return array(
'nodewords_admin_enabled_metatags' => array(
'arguments' => array(
'form' => array(),
),
'file' => 'nodewords_admin.admin.inc',
),
'nodewords_admin_output_fieldset' => array(
'arguments' => array(
'form' => array(),
),
'file' => 'nodewords_admin.admin.inc',
),
);
}
Functions
Name | Description |
---|---|
nodewords_admin_form_taxonomy_form_term_alter | Implements hook_form_FORM_ID_alter(). |
nodewords_admin_form_taxonomy_form_vocabulary_alter | Implements hook_form_FORM_ID_alter(). |
nodewords_admin_help | Implemenation of hook_help(). |
nodewords_admin_menu | Implements hook_menu(). |
nodewords_admin_theme | Implements hook_theme(). |