Same name and namespace in other branches
- 7.x-1.x includes/easy_breadcrumb.admin.inc \_easy_breadcrumb_admin_submit() 1 comment
Process the submitting of the administration form of this module.
Parameters
array $form: Renderable form.
array $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 322
Code
function _easy_breadcrumb_admin_submit(array $form, array &$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;
}
$forced_words_arr = array();
$forced_words = $form_state['values'][EasyBreadcrumbConstants::DB_VAR_CAPITALIZATOR_FORCED_WORDS];
$forced_words = preg_replace('/\\r*\\n+/', ' ', $forced_words);
$forced_words = trim($forced_words);
$forced_words_arr_aux = $forced_words === '' ? array() : preg_split('/\\s+/', $forced_words);
foreach ($forced_words_arr_aux as $word) {
$forced_words_arr[$word] = $word;
}
// Updates the $form_state before passing it to the Drupal system.
$form_state['values'][EasyBreadcrumbConstants::DB_VAR_CAPITALIZATOR_IGNORED_WORDS] = $ignored_words_arr;
$form_state['values'][EasyBreadcrumbConstants::DB_VAR_EXCLUDED_PATHS] = $excluded_paths_arr;
$form_state['values'][EasyBreadcrumbConstants::DB_VAR_CAPITALIZATOR_FORCED_WORDS] = $forced_words_arr;
// Delegates persistence to the existing Drupal system.
system_settings_form_submit($form, $form_state);
}