function path_breadcrumbs_ui_add_form in Path Breadcrumbs 7.2
Same name and namespace in other branches
- 7.3 path_breadcrumbs_ui/path_breadcrumbs_ui.module \path_breadcrumbs_ui_add_form()
Provides multistep form for create/edit path breadcrumbs.
_state
Parameters
$form:
bool $show_navigation:
string $class:
Return value
array
1 call to path_breadcrumbs_ui_add_form()
- path_breadcrumbs_ui_edit_form in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - Form for editing path breadcrumbs.
8 string references to 'path_breadcrumbs_ui_add_form'
- path_breadcrumbs_clone_breadcrumb in path_breadcrumbs_ui/
path_breadcrumbs_ui.admin.inc - Form for path breadcrumbs clone.
- path_breadcrumbs_ui_argument_context_form_ajax_callback in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - Ajax callback for contexts selection form.
- path_breadcrumbs_ui_menu in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - Implements hook_menu().
- _path_breadcrumbs_ui_form_attach_buttons in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - Attach ajax-processed buttons to the form.
- _path_breadcrumbs_ui_form_step_arguments_selection in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - SECOND STEP. Provide form for arguments selection.
File
- path_breadcrumbs_ui/
path_breadcrumbs_ui.module, line 183 - Provide user interface for CRUD operations with path breadcrumbs.
Code
function path_breadcrumbs_ui_add_form($form, &$form_state, $show_navigation = TRUE, $class = '') {
$form['#prefix'] = '<div id="path-breadcrumbs-ui-form-wrapper" class="' . $class . '">';
$form['#suffix'] = '</div>';
if (!isset($form_state['storage']['step'])) {
$form_state['storage']['step'] = 1;
}
$step = $form_state['storage']['step'];
if ($show_navigation) {
$navigation = array();
$navigation[] = t('Basic settings');
$navigation[] = t('Choose arguments');
$navigation[] = t('Selection rules');
$navigation[] = t('Breadcrumbs settings');
// Wrap current navigation item in <span>.
$navigation[$step - 1] = '<span class="current-nav-item">' . $navigation[$step - 1] . '</span>';
$form['navigation'] = array(
'#type' => 'item',
'#markup' => implode(' » ', $navigation),
);
}
$form_build_function = '';
switch ($step) {
case 1:
$form_build_function = 'basic_settings';
break;
case 2:
$form_build_function = 'arguments_selection';
break;
case 3:
$form_build_function = 'selection_rules';
break;
case 4:
$form_build_function = 'breadcrumbs_settings';
break;
}
// Provide default submit callback for all forms.
$form['#submit'][] = 'path_breadcrumbs_ui_add_form_submit';
// Attach styles to form.
$form['#attached']['css'][] = drupal_get_path('module', 'path_breadcrumbs_ui') . '/path_breadcrumbs_ui.css';
// Build form according to current step.
$function = '_path_breadcrumbs_ui_form_step_' . $form_build_function;
if (function_exists($function)) {
$function($form, $form_state);
}
return $form;
}