You are here

protected function MessageListForm::getDateCondition in RNG - Events and Registrations 8.2

Same name and namespace in other branches
  1. 8 src/Form/MessageListForm.php \Drupal\rng\Form\MessageListForm::getDateCondition()
  2. 3.x src/Form/MessageListForm.php \Drupal\rng\Form\MessageListForm::getDateCondition()

Gets the condition containing a date instance.

Parameters

\Drupal\rng\Entity\RuleInterface $rule: The rule.

Return value

\Drupal\rng\Entity\RuleComponentInterface|null A rule component entity, or NULL if no date condition is associated.

2 calls to MessageListForm::getDateCondition()
MessageListForm::buildForm in src/Form/MessageListForm.php
Form constructor.
MessageListForm::getOperations in src/Form/MessageListForm.php
Gets operations for a rule.

File

src/Form/MessageListForm.php, line 234

Class

MessageListForm
Creates message list form.

Namespace

Drupal\rng\Form

Code

protected function getDateCondition(RuleInterface $rule) {
  foreach ($rule
    ->getConditions() as $component) {
    $condition = $component
      ->createInstance();
    if ($condition instanceof CurrentTime) {
      return $component;
    }
  }
  return NULL;
}