You are here

function _easy_breadcrumb_admin_submit in Easy Breadcrumb 7

Same name and namespace in other branches
  1. 6 includes/easy_breadcrumb.admin.inc \_easy_breadcrumb_admin_submit()
  2. 7.2 includes/easy_breadcrumb.admin.inc \_easy_breadcrumb_admin_submit()

Process the submitting of the administration form of this module.

Parameters

Assoc $form: renderable form.

Assoc $form_state: form state.

1 string reference to '_easy_breadcrumb_admin_submit'
_easy_breadcrumb_general_settings_form in includes/easy_breadcrumb.admin.inc
General configuration form.

File

includes/easy_breadcrumb.admin.inc, line 143
Module's admin forms.

Code

function _easy_breadcrumb_admin_submit($form, &$form_state) {

  // Pre-processes the list of ignored words for storing them as an array.
  // Replaces line-endings by spaces and splits words by spaces.
  // E.g.: array('of','and').
  $ignored_words_arr = array();
  $ignored_words = $form_state['values'][EasyBreadcrumbConstants::DB_VAR_CAPITALIZATOR_IGNORED_WORDS];
  $ignored_words = preg_replace('/\\r*\\n+/', ' ', $ignored_words);
  $ignored_words = trim($ignored_words);
  $ignored_words_arr_aux = $ignored_words === '' ? array() : preg_split('/\\s+/', $ignored_words);
  foreach ($ignored_words_arr_aux as $word) {
    $ignored_words_arr[$word] = $word;
  }
  $excluded_paths_arr = array();
  $excluded_paths = $form_state['values'][EasyBreadcrumbConstants::DB_VAR_EXCLUDED_PATHS];
  $excluded_paths = trim($excluded_paths);
  $excluded_paths = preg_replace('/\\s+/', "\r\n", $excluded_paths);
  $excluded_paths_arr_aux = $excluded_paths === '' ? array() : preg_split('/\\r*\\n+/', $excluded_paths);
  foreach ($excluded_paths_arr_aux as $path) {
    $path = trim($path, "/");
    $excluded_paths_arr[$path] = $path;
  }

  // Updates the $form_state before passing it to the Drupal system.
  $form_state['values'][EasyBreadcrumbConstants::DB_VAR_CAPITALIZATOR_IGNORED_WORDS] = $ignored_words_arr;

  // Updates the $form_state before passing it to the Drupal system.
  $form_state['values'][EasyBreadcrumbConstants::DB_VAR_EXCLUDED_PATHS] = $excluded_paths_arr;

  // Delegates persistence to the existing Drupal system.
  system_settings_form_submit($form, $form_state);
}