You are here

protected function WebformEntityElementsValidator::validatePages in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/WebformEntityElementsValidator.php \Drupal\webform\WebformEntityElementsValidator::validatePages()

Validate wizard/card pages.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup|string|null If not valid an error message.

See also

\Drupal\Core\Entity\EntityFormBuilder

\Drupal\webform\Entity\Webform::getSubmissionForm()

1 call to WebformEntityElementsValidator::validatePages()
WebformEntityElementsValidator::validate in src/WebformEntityElementsValidator.php
Validate webform elements.

File

src/WebformEntityElementsValidator.php, line 534

Class

WebformEntityElementsValidator
Webform elements validator.

Namespace

Drupal\webform

Code

protected function validatePages() {
  if (strpos($this->elementsRaw, "'#type': webform_card") !== FALSE && strpos($this->elementsRaw, "'#type': webform_wizard_page") !== FALSE) {
    return [
      $this
        ->t('Pages and cards cannot be used in the same webform. Please remove or convert the pages/cards to the same element type.'),
    ];
  }
  else {
    return NULL;
  }
}