You are here

public static function WebformSubmissionAccess::checkWizardPagesAccess in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Access/WebformSubmissionAccess.php \Drupal\webform\Access\WebformSubmissionAccess::checkWizardPagesAccess()

Check whether a webform submissions' webform has wizard pages/cards.

Parameters

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

Return value

\Drupal\Core\Access\AccessResultInterface The access result.

2 calls to WebformSubmissionAccess::checkWizardPagesAccess()
WebformNodeAccess::checkWebformSubmissionAccess in modules/webform_node/src/Access/WebformNodeAccess.php
Check whether the user can access a node's webform submission.
WebformSubmissionAccessTest::testWebformSubmissionAccess in tests/src/Unit/Access/WebformSubmissionAccessTest.php
Tests the check webform submission access.
1 string reference to 'WebformSubmissionAccess::checkWizardPagesAccess'
webform.routing.yml in ./webform.routing.yml
webform.routing.yml

File

src/Access/WebformSubmissionAccess.php, line 23

Class

WebformSubmissionAccess
Defines the custom access control handler for the webform submission entities.

Namespace

Drupal\webform\Access

Code

public static function checkWizardPagesAccess(WebformSubmissionInterface $webform_submission) {

  // Check wizard pages.
  $has_wizard_pages = $webform_submission
    ->getWebform()
    ->hasWizardPages();

  // Check cards.
  if (\Drupal::moduleHandler()
    ->moduleExists('webform_cards')) {

    /** @var \Drupal\webform_cards\WebformCardsManagerInterface $webform_cards_manager */
    $webform_cards_manager = \Drupal::service('webform_cards.manager');
    $has_cards = $webform_cards_manager
      ->hasCards($webform_submission
      ->getWebform());
  }
  else {
    $has_cards = FALSE;
  }
  return AccessResult::allowedIf($has_wizard_pages || $has_cards);
}