You are here

class HeartbeatActivityStatusPlugin in Heartbeat 7

Class HeartbeatActivityStatusPlugin.

Hierarchy

Expanded class hierarchy of HeartbeatActivityStatusPlugin

File

modules/heartbeat_plugins/plugins/activitystatus.inc, line 10

View source
class HeartbeatActivityStatusPlugin extends HeartbeatBasePlugin implements iHeartbeatPlugin {

  /**
   * loadAttachments().
   * Loads extra attachments onto a heartbeat activity message.
   */
  public function loadAttachments(HeartbeatActivity &$heartbeatActivity, $name = NULL) {
  }

  /**
   * hasContent().
   * True if a plugin provides attachments.
   */
  public function hasContent() {
    return FALSE;
  }

  /**
   * hasAttachmentsContent().
   * True if the message has attachments content.
   */
  public function hasAttachmentsContent() {
    return FALSE;
  }

  /**
   * renderAttachmentsContent().
   */
  public function renderAttachmentsContent(HeartbeatActivity $heartbeatActivity) {
  }

  /**
   * hasButtons().
   * True if a plugin provides attachments.
   */
  public function hasButtons() {
    return FALSE;
  }

  /**
   * hasAttachmentsButtons().
   * True if a message has attachment buttons.
   */
  public function hasAttachmentsButtons() {
    return FALSE;
  }

  /**
   * renderButtons().
   */
  public function renderButtons(HeartbeatActivity $heartbeatActivity) {
  }

  /**
   * isStreamAdaptor().
   */
  public function isStreamAdaptor() {
    return TRUE;
  }

  /**
   * adaptsStream().
   */
  public function adaptsStream() {
    return TRUE;
  }

  /**
   * streamLoaded().
   */
  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);

        // Allow the stream to modify the HeartbeatActivity object.
        // This is mostly used to add some context to the logging.
        $heartbeatStream
          ->modifyActivityMessage($heartbeatActivity);
        $output = drupal_get_form('heartbeat_activity_form_' . $template->message_id, $heartbeatActivity, $heartbeatStream);

        // Add the form as prefix while wishing I'll find a better way.
        $heartbeatStream->prefix .= drupal_render($output);
      }
    }
  }

  /**
   * pluginStreamForm().
   */
  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,
      ),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
HeartbeatActivityStatusPlugin::adaptsStream public function adaptsStream(). Overrides iHeartbeatPlugin::adaptsStream
HeartbeatActivityStatusPlugin::hasAttachmentsButtons public function hasAttachmentsButtons(). True if a message has attachment buttons. Overrides iHeartbeatPlugin::hasAttachmentsButtons
HeartbeatActivityStatusPlugin::hasAttachmentsContent public function hasAttachmentsContent(). True if the message has attachments content. Overrides iHeartbeatPlugin::hasAttachmentsContent
HeartbeatActivityStatusPlugin::hasButtons public function hasButtons(). True if a plugin provides attachments. Overrides iHeartbeatPlugin::hasButtons
HeartbeatActivityStatusPlugin::hasContent public function hasContent(). True if a plugin provides attachments. Overrides iHeartbeatPlugin::hasContent
HeartbeatActivityStatusPlugin::isStreamAdaptor public function isStreamAdaptor(). Overrides iHeartbeatPlugin::isStreamAdaptor
HeartbeatActivityStatusPlugin::loadAttachments public function loadAttachments(). Loads extra attachments onto a heartbeat activity message. Overrides iHeartbeatPlugin::loadAttachments
HeartbeatActivityStatusPlugin::pluginStreamForm public function pluginStreamForm(). Overrides HeartbeatBasePlugin::pluginStreamForm
HeartbeatActivityStatusPlugin::renderAttachmentsContent public function renderAttachmentsContent(). Overrides iHeartbeatPlugin::renderAttachmentsContent
HeartbeatActivityStatusPlugin::renderButtons public function renderButtons(). Overrides iHeartbeatPlugin::renderButtons
HeartbeatActivityStatusPlugin::streamLoaded public function streamLoaded(). Overrides iHeartbeatPlugin::streamLoaded
HeartbeatBasePlugin::$label protected property
HeartbeatBasePlugin::$settings protected property
HeartbeatBasePlugin::$stream protected property
HeartbeatBasePlugin::activityRemoved public function activityRemoved(). 1
HeartbeatBasePlugin::addSettings public function addSettings().
HeartbeatBasePlugin::getAttachments public function getAttachments(). 2
HeartbeatBasePlugin::getLabel public function getLabel().
HeartbeatBasePlugin::getMenuItems public function getMenuItems(). 1
HeartbeatBasePlugin::getSettings public function getSettings().
HeartbeatBasePlugin::pluginAttachmentForm public function pluginAttachmentForm(). The form to add attachments to templates. 2
HeartbeatBasePlugin::pluginUIForm public function pluginUIForm(). 2
HeartbeatBasePlugin::setLabel public function setLabel().
HeartbeatBasePlugin::setStream final public function setStream().
HeartbeatBasePlugin::__construct public function __construct(). 1