function _path_breadcrumbs_ui_form_step_selection_rules 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_selection_rules()
THIRD STEP. Provide form with selection rules.
_state
Parameters
$form:
Return value
mixed
File
- path_breadcrumbs_ui/
path_breadcrumbs_ui.module, line 535 - Provide user interface for CRUD operations with path breadcrumbs.
Code
function _path_breadcrumbs_ui_form_step_selection_rules(&$form, &$form_state) {
// Load breadcrumb from the cache.
$breadcrumb = path_breadcrumbs_object_cache_get($form_state['storage']['machine_name']);
if (empty($breadcrumb)) {
return;
}
// Provide breadcrumb access params.
if (!empty($breadcrumb->access)) {
$form_state['access'] = $breadcrumb->access;
}
else {
$form_state['access'] = array();
}
// Include ctools libraries.
ctools_include('modal');
ctools_include('ajax');
ctools_include('context');
ctools_include('context-access-admin');
ctools_modal_add_plugin_js(ctools_get_access_plugins());
// Build form states for selection rules.
$contexts = path_breadcrumbs_get_contexts_from_arguments($breadcrumb->arguments, TRUE);
$form_state['module'] = 'path_breadcrumbs';
$form_state['callback argument'] = $form_state['storage']['machine_name'];
$form_state['no buttons'] = TRUE;
$form_state['contexts'] = $contexts;
$form['markup'] = array(
'#markup' => '<div class="description">' . t('If there is more than one variant on a page, when the page is visited each variant is given an opportunity to be displayed. Starting from the first variant and working to the last, each one tests to see if its selection rules will pass. The first variant that meets its criteria (as specified below) will be used.') . '</div>',
);
// Load ctools form for selection rules.
$form = ctools_access_admin_form($form, $form_state);
// Attach buttons to the form.
_path_breadcrumbs_ui_form_attach_buttons($form, array(
'next',
'prev',
), 'path_breadcrumbs_ui_add_form');
}