function writeReactions($Row)
{
$Attributes = GetValue('Attributes', $Row);
if (is_string($Attributes)) {
$Attributes = @unserialize($Attributes);
SetValue('Attributes', $Row, $Attributes);
}
Gdn::controller()->EventArguments['ReactionTypes'] = array();
if ($ID = GetValue('CommentID', $Row)) {
$RecordType = 'comment';
} elseif ($ID = GetValue('ActivityID', $Row)) {
$RecordType = 'activity';
} else {
$RecordType = 'discussion';
$ID = GetValue('DiscussionID', $Row);
}
Gdn::controller()->EventArguments['RecordType'] = $RecordType;
Gdn::controller()->EventArguments['RecordID'] = $ID;
echo '<div class="Reactions">';
Gdn_Theme::bulletRow();
// Write the flags.
static $Flags = null;
if ($Flags === null) {
Gdn::controller()->EventArguments['Flags'] =& $Flags;
Gdn::controller()->fireEvent('Flags');
}
// Allow addons to work with flags
Gdn::controller()->EventArguments['Flags'] =& $Flags;
Gdn::controller()->fireEvent('BeforeFlag');
if (!empty($Flags) && is_array($Flags)) {
echo Gdn_Theme::bulletItem('Flags');
echo ' <span class="FlagMenu ToggleFlyout">';
// Write the handle.
echo anchor(sprite('ReactFlag', 'ReactSprite') . ' ' . wrap(t('Flag'), 'span', array('class' => 'ReactLabel')), '', 'Hijack ReactButton-Flag FlyoutButton', array('title' => t('Flag')), true);
echo sprite('SpFlyoutHandle', 'Arrow');
echo '<ul class="Flyout MenuItems Flags" style="display: none;">';
foreach ($Flags as $Flag) {
if (is_callable($Flag)) {
echo '<li>' . call_user_func($Flag, $Row, $RecordType, $ID) . '</li>';
} else {
echo '<li>' . reactionButton($Row, $Flag['UrlCode']) . '</li>';
}
}
Gdn::controller()->fireEvent('AfterFlagOptions');
echo '</ul>';
echo '</span> ';
}
Gdn::controller()->fireEvent('AfterFlag');
Gdn::controller()->fireEvent('AfterReactions');
echo '</div>';
Gdn::controller()->fireEvent('Replies');
}