Commit 86420016 authored by eileen's avatar eileen

[REF] extract token functions

This is an reviewer's commit from https://github.com/civicrm/civicrm-core/pull/12012/files

We are about to merge array formatting changes that will make lots of PRs go stale.

I couldn't get this reviewed & merged before the change but I thought if I could do it
through a sub-commit it would be better than just making it go stale.

This is a simple extraction & I will add merge on pass as it is a reviewer's commit
parent e4d61a85
......@@ -50,14 +50,8 @@ class CRM_Activity_Tokens extends \Civi\Token\AbstractTokenSubscriber {
*/
public function __construct() {
parent::__construct('activity', array_merge(
array(
'activity_id' => ts('Activity ID'),
'activity_type' => ts('Activity Type'),
'subject' => ts('Activity Subject'),
'details' => ts('Activity Details'),
'activity_date_time' => ts('Activity Date-Time'),
),
CRM_Utils_Token::getCustomFieldTokens('Activity')
$this->getBasicTokens(),
$this->getCustomFieldTokens()
));
}
......@@ -118,4 +112,27 @@ class CRM_Activity_Tokens extends \Civi\Token\AbstractTokenSubscriber {
}
}
/**
* Get the basic tokens provided.
*
* @return array token name => token label
*/
protected function getBasicTokens() {
return [
'activity_id' => ts('Activity ID'),
'activity_type' => ts('Activity Type'),
'subject' => ts('Activity Subject'),
'details' => ts('Activity Details'),
'activity_date_time' => ts('Activity Date-Time'),
];
}
/**
* Get the tokens for custom fields
* @return array token name => token label
*/
protected function getCustomFieldTokens() {
return CRM_Utils_Token::getCustomFieldTokens('Activity');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment