You are here

class HeartbeatBasePlugin in Heartbeat 7

abstract class HeartbeatBasePlugin.

Hierarchy

Expanded class hierarchy of HeartbeatBasePlugin

File

modules/heartbeat_plugins/includes/heartbeat_plugin.inc, line 120

View source
class HeartbeatBasePlugin {
  protected $label = '';
  protected $settings = array();
  protected $stream = NULL;

  /**
   * __construct().
   */
  public function __construct($label, $settings) {
    $this
      ->setLabel($label);
    $this
      ->addSettings($settings);
  }

  /**
   * setLabel().
   */
  public function setLabel($label) {
    $this->label = $label;
  }

  /**
   * getLabel().
   */
  public function getLabel() {
    return $this->label;
  }

  /**
   * setStream().
   */
  public final function setStream(HeartbeatStream $heartbeatStream) {
    $this->stream = $heartbeatStream;
  }

  /**
   * addSettings().
   */
  public function addSettings($settings) {
    $this->settings += $settings;
  }

  /**
   * getSettings().
   */
  public function getSettings() {
    return $this->settings;
  }

  /**
   * getAttachments().
   *
   * @param $template
   *   The Heartbeat Template
   * @param $component_type
   *   The type of attachment [buttons, content]
   */
  public function getAttachments($template, $component_type) {
    return array(
      array(
        'name' => $this->settings['plugin_name'],
        'title' => $this->settings['plugin_name'],
        'enabled' => isset($template->attachments[$component_type]['enabled'][$this->settings['plugin_name']]) ? $template->attachments[$component_type]['enabled'][$this->settings['plugin_name']] : 0,
        'weight' => 5,
      ),
    );
  }

  /**
   * activityRemoved().
   */
  public function activityRemoved($uaids, $all) {
  }

  /**
   * getMenuItems().
   */
  public function getMenuItems() {
    return array();
  }

  /**
   * pluginUIForm().
   */
  public function pluginUIForm(&$form, &$form_state) {
  }

  /**
   * pluginAttachmentForm().
   * The form to add attachments to templates.
   */
  public function pluginAttachmentForm(&$form, $form_values, $component_type) {
  }

  /**
   * pluginStreamForm().
   */
  public function pluginStreamForm(&$form, &$form_state) {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
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::pluginStreamForm public function pluginStreamForm(). 2
HeartbeatBasePlugin::pluginUIForm public function pluginUIForm(). 2
HeartbeatBasePlugin::setLabel public function setLabel().
HeartbeatBasePlugin::setStream final public function setStream().
HeartbeatBasePlugin::__construct public function __construct(). 1