You are here

public function HeartbeatFlagAttachmentPlugin::getAttachments in Heartbeat 7

getAttachments().

Parameters

$template: The Heartbeat Template

$component_type: The type of attachment [buttons, content]

Overrides HeartbeatBasePlugin::getAttachments

File

modules/heartbeat_plugins/plugins/flagattachment.inc, line 28

Class

HeartbeatFlagAttachmentPlugin
Class HeartbeatFlagAttachmentPlugin.

Code

public function getAttachments($template, $component_type) {
  $attachments = array();
  $flags = flag_get_flags('heartbeat_activity');
  foreach ($flags as $flag) {
    $args = array(
      '@flag' => $flag->name,
    );
    $attachments[] = array(
      'name' => $this->settings['plugin_name'] . ':' . $flag->name,
      'title' => $component_type == 'buttons' ? t('Heartbeat flag buttons for "@flag"', $args) : t('Heartbeat flag count for "@flag"', $args),
      'enabled' => isset($template->attachments[$component_type]['enabled'][$this->settings['plugin_name'] . ':' . $flag->name]) ? $template->attachments[$component_type]['enabled'][$this->settings['plugin_name'] . ':' . $flag->name] : 0,
      'weight' => 0,
    );
  }
  return $attachments;
}