function views_ui_add_form_to_stack in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.3 includes/admin.inc \views_ui_add_form_to_stack()
- 6.2 includes/admin.inc \views_ui_add_form_to_stack()
Add another form to the stack; clicking 'apply' will go to this form rather than closing the ajax popup.
7 calls to views_ui_add_form_to_stack()
- views_plugin_display::options_submit in plugins/
views_plugin_display.inc - Perform any necessary changes to the form values prior to storage.
- views_plugin_display_page::options_submit in plugins/
views_plugin_display_page.inc - Perform any necessary changes to the form values prior to storage.
- views_ui_add_item_form_submit in includes/
admin.inc - Submit handler for adding new item(s) to a view.
- views_ui_config_item_form_build_group in includes/
admin.inc - Override handler for views_ui_edit_display_form.
- views_ui_config_item_form_expose in includes/
admin.inc - Override handler for views_ui_edit_display_form.
File
- includes/
admin.inc, line 2997 - Provides the Views' administrative interface.
Code
function views_ui_add_form_to_stack($key, &$view, $display_id, $args, $top = FALSE, $rebuild_keys = FALSE) {
if (empty($view->stack)) {
$view->stack = array();
}
$stack = array(
views_ui_build_identifier($key, $view, $display_id, $args),
$key,
&$view,
$display_id,
$args,
);
// If we're being asked to add this form to the bottom of the stack, no
// special logic is required. Our work is equally easy if we were asked to add
// to the top of the stack, but there's nothing in it yet.
if (!$top || empty($view->stack)) {
$view->stack[] = $stack;
}
else {
$keys = array_keys($view->stack);
$first = current($keys);
$last = end($keys);
for ($i = $last; $i >= $first; $i--) {
if (!isset($view->stack[$i])) {
continue;
}
// Move form number $i to the next position in the stack.
$view->stack[$i + 1] = $view->stack[$i];
unset($view->stack[$i]);
}
// Now that the previously $first slot is free, move the new form into it.
$view->stack[$first] = $stack;
ksort($view->stack);
// Start the keys from 0 again, if requested.
if ($rebuild_keys) {
$view->stack = array_values($view->stack);
}
}
}