You are here

public function Template::recipientTypes in Workbench Email 2.x

Same name and namespace in other branches
  1. 8 src/Entity/Template.php \Drupal\workbench_email\Entity\Template::recipientTypes()

Returns the ordered collection of recipient type plugin instances or an individual plugin instance.

Parameters

string $instance_id: (optional) The ID of a recipient type plugin instance to return.

Return value

\Drupal\workbench_email\RecipientTypePluginCollection|\Drupal\workbench_email\Plugin\RecipientTypeInterface Either the recipient type collection or a specific recipient type plugin instance.

Overrides TemplateInterface::recipientTypes

3 calls to Template::recipientTypes()
Template::getPluginCollections in src/Entity/Template.php
Gets the plugin collections used by this object.
Template::getRecipients in src/Entity/Template.php
Calculates recipients.
Template::onDependencyRemoval in src/Entity/Template.php
Informs the entity that entities it depends on will be deleted.

File

src/Entity/Template.php, line 170

Class

Template
Defines the Email Template entity.

Namespace

Drupal\workbench_email\Entity

Code

public function recipientTypes($instance_id = NULL) {
  if (!isset($this->recipientTypeCollection)) {
    $this->recipientTypeCollection = new RecipientTypePluginCollection(\Drupal::service('plugin.manager.recipient_type'), $this->recipient_types);
    $this->recipientTypeCollection
      ->sort();
  }
  if (isset($instance_id)) {
    return $this->recipientTypeCollection
      ->get($instance_id);
  }
  return $this->recipientTypeCollection;
}