You are here

protected function YamlFormSubmissionForm::getPages in YAML Form 8

Get visible wizard pages.

Note: The array of pages is stored in the form's state so that it can be altered using hook_form_alter() and #validate callbacks.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array Array of visible wizard pages.

7 calls to YamlFormSubmissionForm::getPages()
YamlFormSubmissionForm::actions in src/YamlFormSubmissionForm.php
Returns an array of supported actions for the current entity form.
YamlFormSubmissionForm::form in src/YamlFormSubmissionForm.php
Gets the actual form array to be built.
YamlFormSubmissionForm::getCurrentPage in src/YamlFormSubmissionForm.php
Get the current page's key.
YamlFormSubmissionForm::getFirstPage in src/YamlFormSubmissionForm.php
Get first page's key.
YamlFormSubmissionForm::getLastPage in src/YamlFormSubmissionForm.php
Get last page's key.

... See full list

File

src/YamlFormSubmissionForm.php, line 890

Class

YamlFormSubmissionForm
Provides a form to collect and edit submissions.

Namespace

Drupal\yamlform

Code

protected function getPages(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->get('pages') === NULL) {
    $pages = $this
      ->getYamlForm()
      ->getPages();
    foreach ($pages as &$page) {
      $page['#access'] = TRUE;
    }
    $form_state
      ->set('pages', $pages);
  }

  // Get pages and check #access.
  $pages = $form_state
    ->get('pages');
  foreach ($pages as $page_key => $page) {
    if ($page['#access'] === FALSE) {
      unset($pages[$page_key]);
    }
  }
  return $pages;
}