function _path_breadcrumbs_ui_form_step_arguments_selection 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_arguments_selection()
SECOND STEP. Provide form for arguments selection.
_state
Parameters
$form:
Return value
mixed
File
- path_breadcrumbs_ui/
path_breadcrumbs_ui.module, line 459 - Provide user interface for CRUD operations with path breadcrumbs.
Code
function _path_breadcrumbs_ui_form_step_arguments_selection(&$form, &$form_state) {
// Load breadcrumb from the cache.
$breadcrumb = path_breadcrumbs_object_cache_get($form_state['storage']['machine_name']);
if (empty($breadcrumb)) {
return;
}
$form['table'] = array(
'#theme' => 'path_breadcrumbs_ui_form_step_arguments_selection_table',
'#breadcrumbs-path' => $breadcrumb->path,
'argument' => array(),
);
foreach ($breadcrumb->arguments as $keyword => $argument) {
// Default context title it context doesn't attached to the argument.
$context_title = t('No context assigned');
// Get context from cached data if presented.
if (!empty($argument['argument'])) {
ctools_include('context');
$plugin = ctools_get_argument($argument['argument']);
if (!empty($plugin['title'])) {
$context_title = $plugin['title'];
}
}
$form['table']['argument'][$keyword]['#keyword'] = $keyword;
$form['table']['argument'][$keyword]['#position'] = $argument['position'];
$form['table']['argument'][$keyword]['#context'] = $context_title;
// The URL for this ajax button.
$form['table']['argument'][$keyword]['change-url'] = array(
'#attributes' => array(
'class' => array(
"page-manager-context-{$keyword}-change-url",
),
),
'#type' => 'hidden',
'#value' => url('admin/structure/path-breadcrumbs/arguments/settings/' . $breadcrumb->machine_name . '/' . $keyword, array(
'absolute' => TRUE,
)),
);
$form['table']['argument'][$keyword]['change'] = array(
'#type' => 'submit',
'#value' => t('Change'),
'#attributes' => array(
'class' => array(
'ctools-use-modal',
),
),
'#id' => "page-manager-context-{$keyword}-change",
);
// Only show the button if this has a settings form available.
if (!empty($plugin)) {
// The URL for this ajax button.
$form['table']['argument'][$keyword]['settings-url'] = array(
'#attributes' => array(
'class' => array(
"page-manager-context-{$keyword}-settings-url",
),
),
'#type' => 'hidden',
'#value' => url('admin/structure/path-breadcrumbs/arguments/change/' . $breadcrumb->machine_name . '/' . $keyword, array(
'absolute' => TRUE,
)),
);
$form['table']['argument'][$keyword]['settings'] = array(
'#type' => 'submit',
'#value' => t('Settings'),
'#attributes' => array(
'class' => array(
'ctools-use-modal',
),
),
'#id' => "page-manager-context-{$keyword}-settings",
);
}
}
_path_breadcrumbs_ui_form_attach_buttons($form, array(
'next',
'prev',
), 'path_breadcrumbs_ui_add_form');
}