You are here

function contentoptimizer_analyzer_form_elements in Content Optimizer 6.2

Same name and namespace in other branches
  1. 8 contentoptimizer.module \contentoptimizer_analyzer_form_elements()
  2. 7.2 contentoptimizer.module \contentoptimizer_analyzer_form_elements()

Implementation of hook_contentanalysis_analyzer_form_elements() via custom define callback

1 string reference to 'contentoptimizer_analyzer_form_elements'
contentoptimizer_contentanalysis_analyzers in ./contentoptimizer.module
Implementation of hook_contentalalysis_analyzers()

File

./contentoptimizer.module, line 27
Analyzes content for search engine optimization recommendations

Code

function contentoptimizer_analyzer_form_elements($form_state, $analysis = '', $node = 0) {
  drupal_add_js(drupal_get_path('module', 'contentoptimizer') . '/contentoptimizer.js');
  $default_value = $analysis && $analysis['#context'] ? $analysis['#context']['inputs']['analyzer_options']['seo']['keyword'] : '';
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $aid = contentanalysis_get_aid_by_nid(arg(1));
  }
  if ($aid) {
    $sql = '
      SELECT keyword
      FROM {contentoptimizer}
      WHERE aid = %d
    ';
    $default_value = db_result(db_query($sql, $aid));
  }
  $form['keyword'] = array(
    '#type' => 'textfield',
    '#title' => t('Targeted keyword phrase'),
    '#default_value' => $default_value,
  );

  //print_r($form);
  return $form;
}