You are here

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

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

Gets the template collection from an action on the rule.

Parameters

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

Return value

\Drupal\courier\TemplateCollectionInterface|null A template collection entity, or NULL if no template collection is associated.

1 call to MessageListForm::getTemplateCollectionForRule()
MessageListForm::buildForm in src/Form/MessageListForm.php
Form constructor.

File

src/Form/MessageListForm.php, line 214

Class

MessageListForm
Creates message list form.

Namespace

Drupal\rng\Form

Code

protected function getTemplateCollectionForRule(RuleInterface $rule) {
  foreach ($rule
    ->getActions() as $action) {
    $conf = $action
      ->getConfiguration();
    $id = $conf['template_collection'];
    if ($id && ($template_collection = TemplateCollection::load($id))) {
      return $template_collection;
    }
  }
  return NULL;
}