You are here

function apachesolr_exclude_node_form_alter in Apache Solr Exclude Node 7

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

Implements hook_form_alter().

File

./apachesolr_exclude_node.module, line 45
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') && isset($form['type']['#value']) && 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' => 35,
      '#group' => 'additional_settings',
      '#attached' => array(
        'js' => array(
          'vertical-tabs' => drupal_get_path('module', 'apachesolr_exclude_node') . '/apachesolr_exclude_node_vertical_tabs.js',
        ),
      ),
    );
    $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.'),
    );
  }
}