function contentoptimizer_form in Content Optimizer 6
Get form elements for editing keyword.
1 call to contentoptimizer_form()
- contentoptimizer_form_alter in ./
contentoptimizer.module - Implementation of hook_form_alter().
File
- ./
contentoptimizer.module, line 52 - Analyzes node content for search engine optimization recommendations
Code
function contentoptimizer_form($settings, $node) {
drupal_add_css(drupal_get_path('module', 'contentoptimizer') . '/contentoptimizer.css');
$display = variable_get('contentoptimizer_display', array(
'sections',
'main',
));
drupal_add_js(array(
'contentoptimizer' => array(
'analyze_callback' => base_path() . 'contentoptimizer/analyze_js',
'nid' => $node->nid,
'display_sections' => $display['sections'] ? 1 : 0,
'display_main' => $display['main'] ? 1 : 0,
'analyze_on_start' => variable_get('contentoptimizer_analyze_on_start', '0'),
),
), 'setting');
drupal_add_js(drupal_get_path('module', 'contentoptimizer') . '/contentoptimizer.js');
$sql = '
SELECT keyword
FROM {contentoptimizer_keyword}
WHERE nid = %d
';
$keyword = db_result(db_query($sql, $node->nid));
$numforms = 1;
$form['contentoptimizer'] = array(
'#type' => 'fieldset',
'#title' => t('Content optimizer'),
'#tree' => TRUE,
'#attributes' => array(
'class' => 'contentoptimizer',
),
'#weight' => 10,
//'#weight' => $settings['form']['weight'],
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
if ($numforms == 1) {
$form['contentoptimizer']['keyword'] = array(
'#type' => 'textfield',
'#title' => t('Targeted keyword phrase'),
'#default_value' => $keyword,
);
$form['contentoptimizer']['analyze'] = array(
'#type' => 'button',
'#value' => t('Analyze Content'),
'#attributes' => array(
"onclick" => "contentoptimizer_analyze(); return (false);",
),
);
}
return $form;
}