*/
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()
));
}
*/
public function checkActive(\Civi\Token\TokenProcessor $processor) {
// Extracted from scheduled-reminders code. See the class description.
- return
- !empty($processor->context['actionMapping'])
+ return !empty($processor->context['actionMapping'])
&& $processor->context['actionMapping']->getEntity() === 'civicrm_activity';
}
// Q: Could we simplify & move the extra AND clauses into `where(...)`?
$e->query->param('casEntityJoinExpr', 'e.id = reminder.entity_id AND e.is_current_revision = 1 AND e.is_deleted = 0');
- $e->query->select('e.*'); // FIXME: seems too broad.
+ // FIXME: seems too broad.
+ $e->query->select('e.*');
$e->query->select('ov.label as activity_type, e.id as activity_id');
$e->query->join("og", "!casMailingJoinType civicrm_option_group og ON og.name = 'activity_type'");
}
}
+ /**
+ * 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');
+ }
+
}