1

d7+heratbeat version = "7.x-1.1"

I have a module named "love.module" in love.module

/**
 * Implement hook_ctools_plugin_api().
 *
 * This hook is needed to let ctools know about exportables.
 * @see heartbeat_og_ctools_plugin_api
 */
function love_ctools_plugin_api($module, $api) {
  if ($module == 'love' && $api == 'love') {
    return array('version' => 1);
  }
}

and I have a file name love.heartbeat.inc,

    <?php
/**
 * Implements hook_heartbeat_template_info().
 */
function love_heartbeat_template_info() {
  watchdog('-call', 'message', array(), WATCHDOG_NOTICE, 'link');
$heartbeatmessagetemplate = new HeartbeatMessageTemplate();
$heartbeatmessagetemplate->disabled = FALSE; /* Edit this to true to make a default heartbeatmessagetemplate disabled initially */
$heartbeatmessagetemplate->api_version = 1;
$heartbeatmessagetemplate->message_id = 'heartbeat_add_comment2';
$heartbeatmessagetemplate->description = 'user replied on some content';
$heartbeatmessagetemplate->message = '<span>!username replied on !title:</span><blockquote><div>!comment</div></blockquote>';
$heartbeatmessagetemplate->message_concat = '%username% replied on !title.';
$heartbeatmessagetemplate->perms = 2;
$heartbeatmessagetemplate->group_type = 'summary';
$heartbeatmessagetemplate->concat_args = array(
  'group_by' => 'node',
  'group_target' => 'username',
  'group_by_target' => 'title',
  'group_num_max' => '5',
  'merge_separator' => ', ',
  'merge_end_separator' => ' and ',
  'roles' => array(
    1 => 0,
    2 => 0,
    3 => 0,
    4 => 0,
    5 => 0,
  ),
);
$heartbeatmessagetemplate->variables = array(
  '!username' => '',
  '!title' => '',
  '!comment' => '',
);
$heartbeatmessagetemplate->attachments = array(
  'buttons' => array(
    'weight' => array(
      'activitycomments' => '-9',
      'flagattachment:like' => '0',
    ),
    'settings' => array(
      'activitycomments' => array(
        'activitycomments_node' => 0,
      ),
    ),
    'enabled' => array(
      'activitycomments' => 0,
      'flagattachment:like' => 0,
    ),
  ),
  'content' => array(
    'weight' => array(
      'activitycomments' => '-9',
      'flagattachment:like' => '0',
    ),
    'enabled' => array(
      'activitycomments' => 0,
      'flagattachment:like' => 0,
    ),
  ),
);


  return $heartbeatmessagetemplate;
}

but the hook didn't called.who can help me? did I miss somthing?

2
  • Can you please post your module info file as well, .inc files should be included in there.
    – digital
    Dec 7, 2012 at 11:12
  • Have you found the solution for this issue? I have the same problem here. thanks
    – Mika A.
    Sep 17, 2013 at 12:39

1 Answer 1

0

I had the same problem and what you should do is replace

/**
 * Implement hook_ctools_plugin_api().
 *
 * This hook is needed to let ctools know about exportables.
 * @see heartbeat_og_ctools_plugin_api
 */
function love_ctools_plugin_api($module, $api) {
  if ($module == 'love' && $api == 'love') {
    return array('version' => 1);
  }
}

by

/**
 * Implement hook_ctools_plugin_api().
 *
 * This hook is needed to let ctools know about exportables.
 * @see heartbeat_og_ctools_plugin_api
 */
function love_ctools_plugin_api($module, $api) {
  if ($module == 'heartbeat' && $api == 'heartbeat') {
    return array('version' => 1);
  }
}

and after a cache flush, it should appear in heartbeat templates

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.