X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FToken%2FAbstractTokenSubscriber.php;h=69a570f8f380ca1ce5657dc4d03c80f944ed5ed5;hb=417aef11e210c22c178dfbff70544850cde8842d;hp=9609ecca48ba01fba97fc27f38f550f0f4b88d88;hpb=45ee78a6430516d54fa9aecb2f3a0f8b1dd40d8b;p=civicrm-core.git diff --git a/Civi/Token/AbstractTokenSubscriber.php b/Civi/Token/AbstractTokenSubscriber.php index 9609ecca48..69a570f8f3 100644 --- a/Civi/Token/AbstractTokenSubscriber.php +++ b/Civi/Token/AbstractTokenSubscriber.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2018 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -71,14 +71,22 @@ abstract class AbstractTokenSubscriber implements EventSubscriberInterface { /** * @var array - * Ex: array('viewUrl', 'editUrl'). + * List of tokens provided by this class + * Array(string $fieldName => string $label). */ public $tokenNames; + /** + * @var array + * List of active tokens - tokens provided by this class and used in the message + * Array(string $tokenName); + */ + public $activeTokens; + /** * @param $entity * @param array $tokenNames - * Array(string $fieldName => string $label). + * Array(string $tokenName => string $label). */ public function __construct($entity, $tokenNames = array()) { $this->entity = $entity; @@ -143,14 +151,14 @@ abstract class AbstractTokenSubscriber implements EventSubscriberInterface { return; } - $activeTokens = $this->getActiveTokens($e); - if (!$activeTokens) { + $this->activeTokens = $this->getActiveTokens($e); + if (!$this->activeTokens) { return; } $prefetch = $this->prefetch($e); foreach ($e->getRows() as $row) { - foreach ((array) $activeTokens as $field) { + foreach ($this->activeTokens as $field) { $this->evaluateToken($row, $this->entity, $field, $prefetch); } }