You are here

public function Webform::evaluate in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/Condition/Webform.php \Drupal\webform\Plugin\Condition\Webform::evaluate()

Evaluates the condition and returns TRUE or FALSE accordingly.

Return value

bool TRUE if the condition has been met, FALSE otherwise.

Overrides ConditionInterface::evaluate

File

src/Plugin/Condition/Webform.php, line 157

Class

Webform
Provides a 'Webform' condition.

Namespace

Drupal\webform\Plugin\Condition

Code

public function evaluate() {
  if (empty($this->configuration['webforms']) && !$this
    ->isNegated()) {
    return TRUE;
  }
  elseif ($webform = $this
    ->getContextWebform()) {
    return !empty($this->configuration['webforms'][$webform
      ->id()]);
  }
  else {
    return FALSE;
  }
}