function ViewUI::getFormProgress
Same name in other branches
- 9 core/modules/views_ui/src/ViewUI.php \Drupal\views_ui\ViewUI::getFormProgress()
- 8.9.x core/modules/views_ui/src/ViewUI.php \Drupal\views_ui\ViewUI::getFormProgress()
- 10 core/modules/views_ui/src/ViewUI.php \Drupal\views_ui\ViewUI::getFormProgress()
Get the user's current progress through the form stack.
Return value
array|bool FALSE if the user is not currently in a multiple-form stack. Otherwise, an associative array with the following keys:
- current: The number of the current form on the stack.
- total: The total number of forms originally on the stack.
File
-
core/
modules/ views_ui/ src/ ViewUI.php, line 853
Class
- ViewUI
- Stores UI related temporary settings.
Namespace
Drupal\views_uiCode
public function getFormProgress() {
$progress = FALSE;
if (!empty($this->stack)) {
// The forms on the stack have integer keys that don't change as the forms
// are completed, so we can see which ones are still left.
$keys = array_keys($this->stack);
// Add 1 to the array keys for the benefit of humans, who start counting
// from 1 and not 0.
$current = reset($keys) + 1;
$total = end($keys) + 1;
if ($total > 1) {
$progress = [];
$progress['current'] = $current;
$progress['total'] = $total;
}
}
return $progress;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.