function _path_breadcrumbs_ui_form_attach_buttons 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_attach_buttons()
Attach ajax-processed buttons to the form.
Parameters
$form: Form which will be added to the button.
array $buttons: Array with buttons that should be added ('prev', 'next', 'finish').
$form_name: Name of form that addes buttons.
5 calls to _path_breadcrumbs_ui_form_attach_buttons()
- path_breadcrumbs_ui_argument_context_form in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - Provide form that allows to match arguments with contexts.
- _path_breadcrumbs_ui_form_step_arguments_selection in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - SECOND STEP. Provide form for arguments selection.
- _path_breadcrumbs_ui_form_step_basic_settings in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - FIRST STEP. Provide form with basic settings.
- _path_breadcrumbs_ui_form_step_breadcrumbs_settings in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - FOURTH STEP. Provide form for breadcrumb settings.
- _path_breadcrumbs_ui_form_step_selection_rules in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - THIRD STEP. Provide form with selection rules.
File
- path_breadcrumbs_ui/
path_breadcrumbs_ui.module, line 870 - Provide user interface for CRUD operations with path breadcrumbs.
Code
function _path_breadcrumbs_ui_form_attach_buttons(&$form, $buttons = array(), $form_name) {
if ($form_name == 'path_breadcrumbs_ui_add_form' || $form_name == 'path_breadcrumbs_ui_edit_form') {
$form_wrapper = 'path-breadcrumbs-ui-form';
}
else {
$form_wrapper = str_replace('_', '-', $form_name);
}
// Default part for all buttons.
$base = array(
'#type' => 'submit',
'#ajax' => array(
'callback' => $form_name . '_ajax_callback',
'wrapper' => $form_wrapper . '-wrapper',
),
);
$form['actions'] = array(
'#type' => 'actions',
);
if (in_array('prev', $buttons)) {
$form['actions']['prev'] = array(
'#value' => t('Back'),
// Do not validate form when BACK button clicked.
'#limit_validation_errors' => array(),
'#submit' => array(
$form_name . '_submit',
),
) + $base;
}
if (in_array('next', $buttons)) {
$form['actions']['next'] = array(
'#value' => t('Continue'),
) + $base;
}
if (in_array('finish', $buttons)) {
$form['actions']['finish'] = array(
'#value' => t('Finish'),
) + $base;
if ($form_name == 'path_breadcrumbs_ui_add_form') {
$form['actions']['finish']['#ajax']['callback'] = '_path_breadcrumbs_ui_add_form_finish_ajax_callback';
}
}
}