activitystatus.inc in Heartbeat 7
File
modules/heartbeat_plugins/plugins/activitystatus.inc
View source
<?php
class HeartbeatActivityStatusPlugin extends HeartbeatBasePlugin implements iHeartbeatPlugin {
public function loadAttachments(HeartbeatActivity &$heartbeatActivity, $name = NULL) {
}
public function hasContent() {
return FALSE;
}
public function hasAttachmentsContent() {
return FALSE;
}
public function renderAttachmentsContent(HeartbeatActivity $heartbeatActivity) {
}
public function hasButtons() {
return FALSE;
}
public function hasAttachmentsButtons() {
return FALSE;
}
public function renderButtons(HeartbeatActivity $heartbeatActivity) {
}
public function isStreamAdaptor() {
return TRUE;
}
public function adaptsStream() {
return TRUE;
}
public function streamLoaded(HeartbeatStream $heartbeatStream) {
if (!empty($heartbeatStream->config->settings['show_status_form']) && user_access('post activity statuses') && $heartbeatStream
->canPostActivityStatuses()) {
$template = heartbeat_message_template_load($heartbeatStream->config->settings['show_status_form']);
if ($template) {
$heartbeatActivity = new HeartbeatActivity(array(
'actor' => $GLOBALS['user'],
), $template);
$heartbeatStream
->modifyActivityMessage($heartbeatActivity);
$output = drupal_get_form('heartbeat_activity_form_' . $template->message_id, $heartbeatActivity, $heartbeatStream);
$heartbeatStream->prefix .= drupal_render($output);
}
}
}
public function pluginStreamForm(&$form, &$form_state) {
$form['settings']['fs_activity_status'] = array(
'#type' => 'fieldset',
'#title' => t('Prepend a user status form to the stream (like tweets)'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'show_status_form' => array(
'#type' => 'radios',
'#options' => array(
'0' => t('None'),
) + heartbeat_templates_names(),
'#default_value' => isset($form_state['item']->settings['show_status_form']) ? $form_state['item']->settings['show_status_form'] : 0,
),
);
}
}