function seotools_setup_1_form in Drupal SEO Tools 7
Select social media profiles.
_state
Parameters
$form:
Return value
array
File
- ./
seotools.setup.inc, line 44 - Admin page callback for the seotools module.
Code
function seotools_setup_1_form($form, $form_state) {
drupal_set_title(t('SEO Tools setup'));
$form = array();
$instructions = t('Use this form to setup services accounts for SEO Tools.');
$form['instruc'] = array(
'#markup' => $instructions,
);
$form['setup_mode'] = array(
'#type' => 'value',
'#value' => 1,
);
// Google Analytics setup
if (module_exists('googleanalytics')) {
include_once drupal_get_path('module', 'googleanalytics') . '/googleanalytics.admin.inc';
$f = googleanalytics_admin_settings_form($form_state);
$description = '';
if (preg_match('/^UA-\\d{4,}-\\d+$/', $f['account']['googleanalytics_account']['#default_value'])) {
$description = '<div class="messages status">' . t('Your Google Analytics account is set.') . '</div>' . $description;
$f['account']['googleanalytics_account']['#type'] = 'item';
$f['account']['googleanalytics_account']['#markup'] = $f['account']['googleanalytics_account']['#default_value'];
$f['account']['googleanalytics_account']['#description'] = '';
$f['googleanalytics_set'] = array(
'#type' => 'value',
'#value' => '1',
);
}
$form['googleanalytics'] = array(
'#type' => 'fieldset',
'#title' => t('Google Analytics setup'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#description' => $description,
);
unset($f['tracking_title']);
unset($f['tracking']);
unset($f['googleanalytics_custom_var']);
unset($f['advanced']);
unset($f['actions']);
unset($f['#theme']);
unset($f['#submit']);
$f['googleanalytics_account'] = $f['account']['googleanalytics_account'];
unset($f['account']);
$form['googleanalytics'] = array_merge($form['googleanalytics'], $f);
}
// WordStream setup
if (module_exists('wordstream')) {
include_once drupal_get_path('module', 'wordstream') . '/wordstream.admin.inc';
$f = wordstream_admin_settings(array(), $form_state);
$description = t('Wordstream gives you access to live keyword data.');
if (isset($f['wordstream_credits_per_month']['#markup']) && $f['wordstream_credits_per_month']['#markup']) {
$description = '<div class="messages status">' . t('Your WordStream account is setup correctly.') . '</div>' . $description;
unset($f['wordstream_password']);
$f['wordstream_username']['#type'] = 'item';
$f['wordstream_username']['#markup'] = $f['wordstream_username']['#default_value'];
$f['wordstream_username']['#description'] = '';
$f['wordstream_set'] = array(
'#type' => 'value',
'#value' => '1',
);
}
$form['wordstream'] = array(
'#type' => 'fieldset',
'#title' => t('Wordstream setup'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#description' => $description,
);
unset($f['wordstream_cache_time']);
unset($f['wordstream_stats_report_options']);
unset($f['actions']);
unset($f['#theme']);
unset($f['#submit']);
$form['wordstream'] = array_merge($form['wordstream'], $f);
}
// Alchemy setup
include_once drupal_get_path('module', 'alchemy') . '/alchemy.admin.inc';
$f = alchemy_admin_settings(array(), $form_state);
$description = t('Alchemy analyzes content to extract terms, entities, concepts and more.');
if (preg_match('/^([A-Fa-f0-9]{2}){20}$/', $f['alchemy_apikey']['#default_value'])) {
$description = '<div class="messages status">' . t('Your Alchemy api key is set.') . '</div>' . $description;
$f['alchemy_apikey']['#type'] = 'item';
$f['alchemy_apikey']['#markup'] = $f['alchemy_apikey']['#default_value'];
$f['alchemy_apikey']['#description'] = '';
$f['alchemy_set'] = array(
'#type' => 'value',
'#value' => '1',
);
}
$form['alchemy'] = array(
'#type' => 'fieldset',
'#title' => t('Alchemy setup'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#description' => $description,
);
unset($f['alchemy_usecurl']);
unset($f['actions']);
unset($f['#theme']);
unset($f['#submit']);
$form['alchemy'] = array_merge($form['alchemy'], $f);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save settings'),
);
$form['#theme'] = 'system_settings_form';
return $form;
}