You are here

protected function WebformSubmissionConditionsValidator::processState in Webform 8.5

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

Process state by mapping aliases and negation.

Parameters

string $state: A state.

Return value

array An array containing state and negate

5 calls to WebformSubmissionConditionsValidator::processState()
WebformSubmissionConditionsValidator::buildForm in src/WebformSubmissionConditionsValidator.php
Apply form #states to visible elements.
WebformSubmissionConditionsValidator::checkCondition in src/WebformSubmissionConditionsValidator.php
Check a condition.
WebformSubmissionConditionsValidator::isElementEnabled in src/WebformSubmissionConditionsValidator.php
Determine if an element is enabled.
WebformSubmissionConditionsValidator::isElementVisible in src/WebformSubmissionConditionsValidator.php
Determine if an element is visible.
WebformSubmissionConditionsValidator::validateState in src/WebformSubmissionConditionsValidator.php
Validate state with conditions.

File

src/WebformSubmissionConditionsValidator.php, line 860

Class

WebformSubmissionConditionsValidator
Webform submission conditions (#states) validator.

Namespace

Drupal\webform

Code

protected function processState($state) {

  // Set aliases.
  if (isset($this->aliases[$state])) {
    $state = $this->aliases[$state];
  }

  // Set negate.
  $negate = FALSE;
  if (strpos($state, '!') === 0) {
    $negate = TRUE;
    $state = ltrim($state, '!');
  }
  return [
    $state,
    $negate,
  ];
}