+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017 |
+ | Copyright CiviCRM LLC (c) 2004-2018 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2017
+ * @copyright CiviCRM LLC (c) 2004-2018
*/
/**
/**
+ * @deprecated
+ * This is used by CiviMail but will be made redundant by FlexMailer.
* @return array
*/
public static function getRequiredTokens() {
* else an array of the missing tokens
*/
public static function requiredTokens(&$str) {
- $requiredTokens = self::getRequiredTokens();
+ // FlexMailer is a refactoring of CiviMail which provides new hooks/APIs/docs. If the sysadmin has opted to enable it, then use that instead of CiviMail.
+ $requiredTokens = defined('CIVICRM_FLEXMAILER_HACK_REQUIRED_TOKENS') ? Civi\Core\Resolver::singleton()->call(CIVICRM_FLEXMAILER_HACK_REQUIRED_TOKENS, array()) : CRM_Utils_Token::getRequiredTokens();
$missing = array();
foreach ($requiredTokens as $token => $value) {
$returnBlankToken = FALSE,
$escapeSmarty = FALSE
) {
- $key = 'contact';
- if (self::$_tokens[$key] == NULL) {
- // This should come from UF
-
- self::$_tokens[$key]
- = array_merge(
- array_keys(CRM_Contact_BAO_Contact::exportableFields('All')),
- array('checksum', 'contact_id')
- );
- }
+ // Refresh contact tokens in case they have changed. There is heavy caching
+ // in exportable fields so there is no benefit in doing this conditionally.
+ self::$_tokens['contact'] = array_merge(
+ array_keys(CRM_Contact_BAO_Contact::exportableFields('All')),
+ array('checksum', 'contact_id')
+ );
+ $key = 'contact';
// here we intersect with the list of pre-configured valid tokens
// so that we remove anything we do not recognize
// I hope to move this step out of here soon and