Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
trying to designate custom heartbeat templates using hook_heartbeat_template_info(). I adapted the logic from heartbeat.api.php, but to no avail. The hooks it not run, neither upon re-installing my custom module, nor upon flushing Drupal's cache. The hook is simply never called.
/**
* Implementation of hook_heartbeat_template_info()
*/
function mymodule_heartbeat_template_info() {
$heartbeatmessagetemplates = array();
$heartbeatmessagetemplate = new HeartbeatMessageTemplate;
$heartbeatmessagetemplate->disabled = FALSE;
$heartbeatmessagetemplate->api_version = 1;
$heartbeatmessagetemplate->message_id = 'heartbeat_friendship_approved';
$heartbeatmessagetemplate->description = 'User approved friendship';
$heartbeatmessagetemplate->message = '!requestee and !requester are now friends';
$heartbeatmessagetemplate->message_concat = '!requestee is now friends with %requester_name%.';
$heartbeatmessagetemplate->perms = 4;
$heartbeatmessagetemplate->group_type = 'summary';
$heartbeatmessagetemplate->concat_args = array(
'group_by' => 'user',
'group_target' => 'requester_name',
'group_by_target' => 'requestee',
'group_num_max' => '4',
'merge_separator' => ', ',
'merge_end_separator' => 'and',
);
$heartbeatmessagetemplate->variables = array(
'!requestee' => '',
'!requester' => '',
'!requester_name' => '',
);
$heartbeatmessagetemplate->attachments = array(
'flagattachment' => array(
'flags' => array(
'like' => 'like',
),
),
'flag_count_enabled' => array(
'flags' => 0,
),
'activitycomments' => array(
'enabled' => 0,
'activitycomments_node' => 0,
),
);
$heartbeatmessagetemplates['heartbeat_friendship_approved'] = $heartbeatmessagetemplate;
return $heartbeatmessagetemplates;
}
Comments
Comment #1
Stalski CreditAttribution: Stalski commentedYou did implement the ctools hook as well? I just saw I did not mention that in the api description. So I updated that.
For your quicker response, an excerpt from heartbeat.api.inc:
and
If this was not the problem, please reopen this issue and we can take it on, but as your description, it's very likely it is.
Comment #3
muschpusch CreditAttribution: muschpusch commentedAnd you need :)