You are here

function search_api_exclude_form_node_type_form_alter in Search API exclude 7

Same name and namespace in other branches
  1. 8 search_api_exclude.module \search_api_exclude_form_node_type_form_alter()

Implements hook_form_FORM_ID_alter() for node_type_form().

File

./search_api_exclude.module, line 117
Allows users to exclude specific nodes from indexing by Search API.

Code

function search_api_exclude_form_node_type_form_alter(array &$form, array &$form_state) {
  if (user_access('administer search_api_exclude')) {
    $types = variable_get('search_api_exclude_types', array());
    $form['search_api_exclude'] = array(
      '#type' => 'fieldset',
      '#title' => t('Search API exclude'),
      '#collapsible' => TRUE,
      '#collapsed' => TRUE,
      '#group' => 'additional_settings',
    );
    $form['search_api_exclude']['search_api_exclude_setting'] = array(
      '#type' => 'checkbox',
      '#title' => t('Search API Exclude support'),
      '#default_value' => !empty($form['#node_type']->type) && !empty($types[$form['#node_type']->type]),
      '#description' => t('If enabled, content of this type will have an additional "Exclude from Search API" checkbox in its edit form, that allows it to be excluded from all Search API indexes.'),
    );
    $form['#submit'][] = 'search_api_exclude_form_node_type_form_submit';
  }
}