You are here

function custom_breadcrumbs_admin_settings in Custom Breadcrumbs 6.2

Same name and namespace in other branches
  1. 7.2 custom_breadcrumbs.admin.inc \custom_breadcrumbs_admin_settings()

Form builder; Configure basic and advanced custom breadcrumbs settings for this site.

See also

system_settings_form()

5 string references to 'custom_breadcrumbs_admin_settings'
custom_breadcrumbs_identifiers_form_alter in custom_breadcrumbs_identifiers/custom_breadcrumbs_identifiers.module
Implements hook_form_alter().
custom_breadcrumbs_menu in ./custom_breadcrumbs.module
Implements hook_menu().
custom_breadcrumbs_panels_form_alter in custom_breadcrumbs_panels/custom_breadcrumbs_panels.module
Implements hook_form_alter().
custom_breadcrumbs_paths_form_alter in custom_breadcrumbs_paths/custom_breadcrumbs_paths.module
Implements hook_form_alter().
custom_breadcrumbs_taxonomy_form_alter in custom_breadcrumbs_taxonomy/custom_breadcrumbs_taxonomy.module
Implements hook_form_alter().

File

./custom_breadcrumbs.admin.inc, line 372
Admin page callback file for the custom_breadcrumbs module.

Code

function custom_breadcrumbs_admin_settings() {
  $form = array();
  drupal_set_title(t('Custom Breadcrumbs Configuration'));
  $form['settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Basic settings'),
    '#collapsible' => TRUE,
  );
  $form['settings']['custom_breadcrumb_home'] = array(
    '#type' => 'textfield',
    '#title' => t('Home breadcrumb text'),
    '#default_value' => variable_get('custom_breadcrumb_home', t('Home')),
    '#description' => t('This text will be displayed as the first item of the breadcrumb trail. Typically Home or your site name. Leave blank to have no home breadcrumb. You can also specify a title attribute (tooltip text) to add to the link. Just separate the crumb text and the title attribute text with a pipe (|) symbol (i.e. Home crumb text|attribute title text).'),
  );
  $form['settings']['custom_breadcrumbs_append_page_title_fieldset'] = array(
    '#type' => 'fieldset',
    '#title' => t('Page Title'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['settings']['custom_breadcrumbs_append_page_title_fieldset']['custom_breadcrumbs_append_page_title'] = array(
    '#type' => 'checkbox',
    '#title' => t('Append page title'),
    '#default_value' => variable_get('custom_breadcrumbs_append_page_title', FALSE),
    '#description' => t('Append the page title at the end of every breadcrumb.'),
  );
  $form['settings']['custom_breadcrumbs_append_page_title_fieldset']['custom_breadcrumbs_append_page_title_no_link'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use plain text page title crumb'),
    '#default_value' => variable_get('custom_breadcrumbs_append_page_title_no_link', FALSE),
    '#description' => t('Enable this option to remove the link from the appended page title crumb.'),
  );
  $form['settings']['custom_breadcrumbs_menu_structure'] = array(
    '#type' => 'fieldset',
    '#title' => t('Menu structure'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['settings']['custom_breadcrumbs_menu_structure']['custom_breadcrumbs_set_menu_breadcrumb'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use the menu structure to set the breadcrumb trail'),
    '#default_value' => variable_get('custom_breadcrumbs_set_menu_breadcrumb', FALSE),
    '#description' => t("If enabled, the default breadcrumb trail will be patterned after the page's placement in the menu structure. Select the menus that this option will apply to below. Note that this default can be superceded by other custom breadcrumbs."),
    '#weight' => -30,
  );
  $menu_options = array();
  foreach (menu_get_names() as $name) {
    $menu_options[$name] = $name;
  }
  $form['settings']['custom_breadcrumbs_menu_structure']['custom_breadcrumbs_menu_list'] = array(
    '#type' => 'select',
    '#title' => t('Menu name'),
    '#options' => $menu_options,
    '#default_value' => variable_get('custom_breadcrumbs_menu_list', FALSE),
    '#description' => t("Pages within selected menus will have a default breadcrumb patterned after the menu structure."),
    '#multiple' => TRUE,
    '#weight' => -20,
  );
  $form['adv_settings'] = array(
    '#type' => 'fieldset',
    '#title' => t('Advanced settings'),
    '#collapsible' => TRUE,
  );
  $form['adv_settings']['custom_breadcrumbs_set_global_home_breadcrumb'] = array(
    '#type' => 'checkbox',
    '#title' => t('Set the home breadcrumb text on all pages'),
    '#default_value' => variable_get('custom_breadcrumbs_set_global_home_breadcrumb', FALSE),
    '#description' => t("If enabled, the home breadcrumb text will be used on all pages, not just those with defined custom breadcrumbs. If you don't want a home breadcrumb to be displayed, just enable this option and make sure that the <em>home breadcrumb text</em> above is empty."),
    '#weight' => -40,
  );
  $form['adv_settings']['custom_breadcrumbs_use_php_in_titles'] = array(
    '#type' => 'checkbox',
    '#title' => t('Allow the use of PHP to set titles and paths'),
    '#default_value' => variable_get('custom_breadcrumbs_use_php_in_titles', FALSE),
    '#description' => t("If enabled, small PHP code snippets (less than 250 characters) can be used in the titles and paths section of the create breadcrumb forms. Each should return an array with text strings for each part of the crumb. Alternatively, a PHP code snippet placed in the titles box can return an associative array with elements 'titles' and 'paths', each an array of text strings. If this is done, the paths text field will be ignored."),
    '#weight' => -35,
  );
  $form['adv_settings']['custom_breadcrumbs_force_active_trail'] = array(
    '#type' => 'checkbox',
    '#title' => t('Force the active trail'),
    '#description' => t('This options sets the active trail to match the custom breadcrumb trail and overrides the normal theme_links() implementation to add the active-trail class to links. This is experimental and may not work as expected. If this is of interest to you, please test and report back to the custom breadcrumbs issue queue.'),
    '#default_value' => variable_get('custom_breadcrumbs_force_active_trail', FALSE),
    '#weight' => -10,
  );
  $form['adv_settings']['custom_breadcrumbs_excluded'] = array(
    '#type' => 'fieldset',
    '#title' => t('Excluded paths'),
    '#description' => t("If enabled, the custom breadcrumbs module will not modify breadcrumbs set on the paths defined below."),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['adv_settings']['custom_breadcrumbs_excluded']['custom_breadcrumbs_use_exclude_list'] = array(
    '#type' => 'checkbox',
    '#title' => t('Exclude custom breadcrumbs from some pages'),
    '#default_value' => variable_get('custom_breadcrumbs_use_exclude_list', FALSE),
  );
  $default_exclude_paths = array();
  if (module_exists('admin_menu')) {
    $default_exclude_paths[] = 'admin/user/user';
    $default_exclude_paths[] = 'user';
  }
  $default = implode(',', $default_exclude_paths);
  $form['adv_settings']['custom_breadcrumbs_excluded']['custom_breadcrumbs_exclude_list'] = array(
    '#type' => 'textfield',
    '#title' => t('Do not set custom breadcrumbs on the following paths'),
    '#default_value' => variable_get('custom_breadcrumbs_exclude_list', $default),
    '#description' => t("A comma delimited set of paths to exclude from custom breadcrumbs. The '*' character can be used as a wildcard."),
  );
  $form['adv_settings']['custom_breadcrumbs_identifiers'] = array(
    '#type' => 'fieldset',
    '#title' => t('HTML element identifiers'),
    '#description' => t("Enabling one or more of these options will provide html identifiers (class or id) for theming custom breadcrumbs links. Style rules can then be defined in the styles.css file located in the site's theme directory."),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['adv_settings']['custom_breadcrumbs_identifiers']['cb_identifier_options'] = array(
    '#type' => 'fieldset',
    '#collapsible' => FALSE,
  );
  $form['adv_settings']['custom_breadcrumbs_identifiers']['cb_identifier_options']['custom_breadcrumbs_home_id'] = array(
    '#type' => 'checkbox',
    '#title' => t("Add a custom-breadcrumbs-home ID attribute to the home breadcrumb item."),
    '#default_value' => variable_get('custom_breadcrumbs_home_id', FALSE),
  );
  $form['adv_settings']['custom_breadcrumbs_identifiers']['cb_identifier_options']['custom_breadcrumbs_parts_class'] = array(
    '#type' => 'checkbox',
    '#title' => t("Add a numbered class attribute for each breadcrumb item."),
    '#description' => t("If enabled, a custom-breadcrumbs-item-N class attribute will be assigned for each item, where N designates the item number, starting with the first item after the home breadcrumb."),
    '#default_value' => variable_get('custom_breadcrumbs_parts_class', FALSE),
  );
  $form['adv_settings']['custom_breadcrumbs_identifiers']['cb_identifier_options']['custom_breadcrumbs_even_odd_class'] = array(
    '#type' => 'checkbox',
    '#title' => t("Add even and odd classes to breadcrumb items."),
    '#default_value' => variable_get('custom_breadcrumbs_even_odd_class', FALSE),
  );
  $form['adv_settings']['custom_breadcrumbs_identifiers']['cb_identifier_options']['custom_breadcrumbs_type_class'] = array(
    '#type' => 'checkbox',
    '#title' => t("Store an identifier for breadcrumb theming."),
    '#description' => t("If enabled, the breadcrumb class 'custom-breadcrumbs-<em>type</em>' (where <em>type</em> is the breadcrumb type) can be retrieved and used in the breadcrumb theme override. The function <strong>custom_breadcrumbs_unique_breadcrumb_id()</strong> will return a string containing the class name."),
    '#default_value' => variable_get('custom_breadcrumbs_type_class', FALSE),
  );
  $form['adv_settings']['custom_breadcrumbs_identifiers']['cb_identifier_options']['custom_breadcrumbs_append_bid_class'] = array(
    '#type' => 'checkbox',
    '#title' => t("Append a unique breadcrumb id number to the custom-breadcrumbs-<em>type</em> identifier."),
    '#description' => t("If this option and 'Store an identifier for breadcrumb theming' are both enabled, the identifer will be custom-breadcrumbs-<em>type</em>-<em>id</em>, where id is the unique breadcrumb id number."),
    '#default_value' => variable_get('custom_breadcrumbs_append_bid_class', FALSE),
  );
  $form['adv_settings']['module_weights'] = array(
    '#type' => 'fieldset',
    '#title' => t('Module weights'),
    '#description' => t('If enabled, the relative module weights can be adjusted in the table below. Modules with lighter weights will provide custom breadcrumbs that can be modified, or overriden, by heavier modules.'),
    '#collapsible' => TRUE,
    '#collapsed' => FALSE,
  );
  $form['adv_settings']['module_weights']['custom_breadcrumbs_adjust_module_weights'] = array(
    '#type' => 'checkbox',
    '#title' => t('Adjust module weights'),
    '#default_value' => FALSE,
  );
  $form['adv_settings']['module_weights']['table'] = custom_breadcrumbs_module_weight();
  if (!empty($form['adv_settings']['module_weights']['table'])) {
    $form['adv_settings']['module_weights']['table']['#theme'] = 'custom_breadcrumbs_module_weight';
  }
  else {
    unset($form['adv_settings']['module_weights']);
  }
  $form['#submit'][] = 'custom_breadcrumbs_admin_settings_submit';
  return system_settings_form($form);
}