function _path_breadcrumbs_ui_form_step_breadcrumbs_settings_submit in Path Breadcrumbs 7.2
Same name and namespace in other branches
- 7.3 path_breadcrumbs_ui/path_breadcrumbs_ui.module \_path_breadcrumbs_ui_form_step_breadcrumbs_settings_submit()
Submit callback for breadcrumbs settings form (fourth step).
_state
Parameters
$form:
1 string reference to '_path_breadcrumbs_ui_form_step_breadcrumbs_settings_submit'
- _path_breadcrumbs_ui_form_step_breadcrumbs_settings in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - FOURTH STEP. Provide form for breadcrumb settings.
File
- path_breadcrumbs_ui/
path_breadcrumbs_ui.module, line 784 - Provide user interface for CRUD operations with path breadcrumbs.
Code
function _path_breadcrumbs_ui_form_step_breadcrumbs_settings_submit($form, &$form_state) {
$values = $form_state['values'];
// Remove row when DELETE button submitted.
$delete = array_search(t('Delete'), $values, TRUE);
if ($delete !== FALSE) {
$deleted_key = drupal_substr($delete, 7);
unset($values['breadcrumbs_table'][$deleted_key]);
unset($form['breadcrumbs_table'][$deleted_key]);
$form_state['storage']['rows_count']--;
$form_state['rebuild'] = TRUE;
}
// Action for ADD MORE button.
if (isset($values['more']) && $values['op'] == $values['more']) {
$form_state['storage']['rows_count']++;
$form_state['rebuild'] = TRUE;
}
// Rebuild breadcrumb titles and paths.
$titles = array();
$paths = array();
foreach ($values['breadcrumbs_table'] as $value) {
$titles[] = $value['left_value'];
$paths[] = $value['right_value'];
}
// Update titles and paths in cache.
$machine_name = $form_state['storage']['machine_name'];
$breadcrumbs = path_breadcrumbs_object_cache_get($machine_name);
$breadcrumbs->titles = $titles;
$breadcrumbs->paths = $paths;
path_breadcrumbs_object_cache_set($machine_name, $breadcrumbs);
}