* This file is divided into static hooks (hooks with string literal names) and
* dynamic hooks (hooks with pattern-derived string names).
*
- * There are also some utility or api functions available.
+ * Note that the export hooks like
+ * ° hook_defaults_heartbeat_template_info,
+ * ° hook_defaults_heartbeat_stream_info
+ * ° hook_heartbeat_plugin_info
+ * are dependant on CTools. This requires you to include the
+ * hook_ctools_plugin_api() as well.
*
+ * There are also some utility or api functions available.
*
* heartbeat_api_log
* API function to log a message when an event occurs. Most people will log through
*/
/**
+ * Implement hook_ctools_plugin_api().
+ *
+ * This hook is needed to let ctools know about exportables.
+ */
+function hook_ctools_plugin_api($module, $api) {
+ if ($module == 'yourmodule' && $api == 'yourmodule') {
+ return array('version' => 1);
+ }
+}
+
+/**
* Register default heartbeat streams.
+ *
+ * @see hook_ctools_plugin_api.
*/
function hook_defaults_heartbeat_stream_info() {
/**
* Register heartbeat templates.
+ *
+ * @see hook_ctools_plugin_api.
*/
function hook_defaults_heartbeat_template_info() {
}
/**
+ * Take action when activity is being saved.
+ *
+ * @param HeartbeatActivity $heartbeatActivity
+ * The heartbeat activity object.
+ */
+function hook_heartbeat_activity_save($heartbeatActivity) {
+ // Do your stuff...
+}
+
+/**
* Hook to alter the stream or take action when the stream
* is loaded.
*/
// Link to the pages.
if (!$heartbeatStream->isPage() && (!$heartbeatStream->isAjax() || $heartbeatStream->config->block_show_pager == 3)) {
- $path = 'heartbeat/' . $heartbeatStream->config->name;
+ $path = 'heartbeat/' . $heartbeatStream->config->class;
if (isset($attributes['attributes']['onclick'])) {
unset($attributes['attributes']['onclick']);
}
'#options' => $options,
);
- // Stream settings
+ // Stream settings.
$form['settings']['fs_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Settings'),
'#description' => t('Maximum gap for the same activity to be grouped together and before an identical activity can be logged again'),
);
- // Blocks settings
+ // Blocks settings.
$form['settings']['fs_blocks'] = array(
'#type' => 'fieldset',
'#title' => t('Blocks'),
'#default_value' => $heartbeatStreamConfig->block_show_pager,
);
- // Page settings
+ // Page settings.
$form['settings']['fs_pages'] = array(
'#type' => 'fieldset',
'#title' => t('Pages'),
$form['settings']['fs_pages']['page_disabled'] = array(
'#title' => t('Page disabled'),
'#type' => 'checkbox',
- '#default_value' => 1,
+ '#default_value' => $heartbeatStreamConfig->page_disabled,
);
$form['settings']['fs_pages']['profilePage'] = array(
'#title' => t('Add user profile page'),
unset($form_state['values']['settings'][$name]);
}
}
+
cache_clear_all('heartbeat_streams', 'cache');
drupal_static_reset('heartbeat_streams');
+
+ if ($form_state['item']->page_disabled != $form_state['values']['settings']['page_disabled']) {
+ // clear menu cache.
+ menu_cache_clear_all();
+ }
}
/**