function no_index_form_alter in Util 7
Same name and namespace in other branches
- 6.3 contribs/no_index/no_index.module \no_index_form_alter()
 
Implements hook_form_alter(). Settings to prevent search indexing.
File
- contribs/
no_index/ no_index.module, line 14  - Prevent search indexing. Adding a robots header isn't necessarily a sure thing. It's not supported by all search engines and will not guarantee your site will be excluded. Read:…
 
Code
function no_index_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {
    // Settings
    case 'util_page':
      $form['no_index'] = array(
        '#type' => 'fieldset',
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#title' => t('No search indexing'),
        '#description' => t('Produces site directive telling search engines to go away.'),
      );
      $form['no_index']['no_index_setting'] = array(
        '#type' => 'radios',
        '#options' => array(
          t('No'),
          t('Yes'),
        ),
        '#title' => t('No search indexing'),
        '#description' => t('Produces site directive telling search engines to go away.'),
        '#default_value' => variable_get('no_index_setting', 0),
        '#attributes' => array(
          'class' => array(
            'container-inline',
          ),
        ),
      );
  }
}