You are here

function disable_breadcrumbs_settings_form in Disable breadcrumbs 6

Same name and namespace in other branches
  1. 7 disable_breadcrumbs.admin.inc \disable_breadcrumbs_settings_form()

Implementation of hook_form(). Settings/configuration form.

1 string reference to 'disable_breadcrumbs_settings_form'
disable_breadcrumbs_settings_page in ./disable_breadcrumbs.admin.inc
@file Admin settings page and checked nodes summary table

File

./disable_breadcrumbs.admin.inc, line 19
Admin settings page and checked nodes summary table

Code

function disable_breadcrumbs_settings_form() {
  $disable_breadcrumbs_all = variable_get('disable_breadcrumbs_all', NULL);
  if ($disable_breadcrumbs_all) {
    drupal_set_message(t("All breadcrumbs are currently disabled"), 'warning');
  }
  $content_types = array_map('check_plain', node_get_types('names'));
  $form['node_types'] = array(
    '#type' => 'fieldset',
    '#title' => t('Content type settings'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['node_types']['disable_breadcrumbs_node_types'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types that Disable breadcrumbs can be used on'),
    '#options' => $content_types,
    '#default_value' => variable_get('disable_breadcrumbs_node_types', array()),
    '#multiple' => TRUE,
  );
  $form['node_types']['disable_breadcrumbs_node_types_all'] = array(
    '#type' => 'checkboxes',
    '#title' => t('Content types that you want to disable all breadcrumbs for'),
    '#options' => $content_types,
    '#default_value' => variable_get('disable_breadcrumbs_node_types_all', array()),
    '#multiple' => TRUE,
  );
  $form['disable_all'] = array(
    '#type' => 'fieldset',
    '#title' => t('ALL Breadcrumbs'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['disable_all']['disable_breadcrumbs_all'] = array(
    '#type' => 'checkbox',
    '#title' => t('Disable') . ' <b>' . t('ALL') . '</b> ' . t('breadcrumbs'),
    '#description' => t('This will disable all breadcrumbs on your site, regardless of entity type or page callback.'),
    '#default_value' => variable_get('disable_breadcrumbs_all', NULL),
  );
  $form['reset_breadcrumbs'] = array(
    '#type' => 'fieldset',
  );
  $form['reset_breadcrumbs']['button'] = array(
    '#type' => 'submit',
    '#value' => t("Reset breadcrumbs"),
    '#prefix' => '<div id="reset-breadcrumbs">',
    '#suffix' => '</div>',
    '#submit' => array(
      'disable_breadcrumbs_settings_form_delete_all_submit',
    ),
    '#attributes' => array(
      'id' => 'reset-breadcrumbs',
      'onclick' => 'return confirm("Are you sure you want to clear the disable_breadcrumbs database table?")',
    ),
  );
  $form['reset_breadcrumbs']['markup'] = array(
    '#value' => '(<em>' . t('reset disable_breadcrumbs database table - all disabled breadcrumbs on nodes will be removed.') . '</em>)',
  );
  $form['#redirect'] = FALSE;
  return system_settings_form($form);
}