function nodewords_form_node_type_form_alter in Nodewords: D6 Meta Tags 6
Implements hook_form_FORM_ID_alter().
File
- ./
nodewords.module, line 96 - Implement an API that other modules can use to implement meta tags.
Code
function nodewords_form_node_type_form_alter(&$form, &$form_state) {
if (isset($form['#node_type'])) {
$form['nodewords'] = array(
'#type' => 'fieldset',
'#title' => t('Meta tags settings'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#group' => 'additional_settings',
);
$form['nodewords']['nodewords_edit_metatags'] = array(
'#type' => 'checkbox',
'#title' => t('Allow editing of meta tags'),
'#description' => t('If selected, the node edit form will allow the users with the right permissions to edit the meta tags associated with nodes of this content type.'),
'#default_value' => variable_get('nodewords_edit_metatags_' . $form['#node_type']->type, TRUE),
);
$form['nodewords']['metatags_generation'] = array(
'#type' => 'fieldset',
'#title' => t('Node meta tags generation options'),
'#description' => t('These options change how a meta tag content is generated from the node content. These settings apply to specific meta tags.'),
'#collapsible' => TRUE,
);
$options = array(
NODEWORDS_GENERATION_NEVER => t('Do not generate meta tags content'),
NODEWORDS_GENERATION_WHEN_EMPTY => t('Generate meta tag content when the meta tag content is empty (default)'),
NODEWORDS_GENERATION_ALWAYS => t('Always generate the meta tag content'),
);
$form['nodewords']['metatags_generation']['nodewords_metatags_generation_method'] = array(
'#type' => 'radios',
'#options' => $options,
'#default_value' => variable_get('nodewords_metatags_generation_method_' . $form['#node_type']->type, NODEWORDS_GENERATION_WHEN_EMPTY),
);
$options = array(
NODEWORDS_GENERATION_BODY => t('Generate meta tags content from the node body'),
NODEWORDS_GENERATION_TEASER => t('Generate meta tags content from the node teaser (default)'),
NODEWORDS_GENERATION_TEASER_BODY => t('Generate meta tags content from the node teaser, or the node body when the node teaser is empty'),
);
$form['nodewords']['metatags_generation']['nodewords_metatags_generation_source'] = array(
'#type' => 'radios',
'#title' => t('Generation source'),
'#options' => $options,
'#default_value' => variable_get('nodewords_metatags_generation_source_' . $form['#node_type']->type, NODEWORDS_GENERATION_TEASER),
);
$form['nodewords']['metatags_generation']['nodewords_use_alt_attribute'] = array(
'#type' => 'checkbox',
'#title' => t('Replace the tag IMG content with the attribute ALT'),
'#default_value' => variable_get('nodewords_use_alt_attribute_' . $form['#node_type']->type, TRUE),
);
$options = array(
'imagebrowser' => 'imagebrowser.module',
'img_assist' => 'img_assist.module',
);
$form['nodewords']['metatags_generation']['nodewords_filter_modules_output'] = array(
'#type' => 'checkboxes',
'#title' => t('Filter the text added by third-party modules in the node teaser'),
'#options' => $options,
'#default_value' => variable_get('nodewords_filter_modules_output_' . $form['#node_type']->type, array()),
'#checkall' => TRUE,
);
$form['nodewords']['metatags_generation']['nodewords_filter_regexp'] = array(
'#type' => 'textfield',
'#title' => t('Custom regular expression'),
'#description' => t('A regular expression used to filter the text added in the node teaser from a third-party module. The regular expression uses the <a href="http://www.php.net/manual/en/pcre.pattern.php">Perl compatible</a> syntax. Slashes are assumed as delimiters and all expressions are case-sensitive.'),
'#element_validate' => array(
'nodewords_filter_regex_validate',
),
'#default_value' => variable_get('nodewords_filter_regexp_' . $form['#node_type']->type, ''),
'#field_prefix' => '/',
'#field_suffix' => '/',
'#size' => 60,
);
foreach (nodewords_get_possible_tags() as $name => $info) {
$function = $info['callback'] . '_settings_form';
$options = array();
if (function_exists($function)) {
$function($form, 'node_type_form', $options);
}
}
}
}