You are here

public function Webform::evaluate in Webform 6.x

Same name and namespace in other branches
  1. 8.5 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 125

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;
  }
}