You are here

function apachesolr_exclude_node_form_alter in Apache Solr Exclude Node 6

Same name and namespace in other branches
  1. 7 apachesolr_exclude_node.module \apachesolr_exclude_node_form_alter()

Implementation of hook_form_alter().

File

./apachesolr_exclude_node.module, line 30
Module file for the Apache Solr Exclude Node module.

Code

function apachesolr_exclude_node_form_alter(&$form, $form_state, $form_id) {
  if (strpos($form_id, '_node_form') !== FALSE && user_access('exclude nodes from apache solr') && variable_get('apachesolr_exclude_node_enable_' . $form['type']['#value'], 0)) {
    $node = $form['#node'];
    $form['apachesolr_exclude_node'] = array(
      '#type' => 'fieldset',
      '#title' => t('Apache Solr exclude'),
      '#description' => t('Apache Solr exclude'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#weight' => 30,
    );
    $form['apachesolr_exclude_node']['apachesolr_exclude_node_enabled'] = array(
      '#type' => 'checkbox',
      '#title' => t('Exclude from Apache Solr'),
      '#default_value' => isset($node->apachesolr_exclude_node_enabled) ? $node->apachesolr_exclude_node_enabled : 0,
      '#description' => t('Exclude this node from being indexing in Apache Solr.'),
    );
  }
}