/** * {@inheritdoc} */ public function getURI(NotificationInterface $interface) { $nodeIdList = $interface->getResourceIdList(); if (count($nodeIdList) === 1) { return 'node/' . reset($nodeIdList); } }
public function format(NotificationInterface $notification) { $ret = ['event' => $notification->getResourceType() . ':' . $notification->getAction(), 'id' => implode(', ', $notification->getResourceIdList()), 'level' => $notification->getLevel(), 'msg' => $notification->getMessageId()]; $text = []; foreach ($ret as $key => $value) { $text[] = '<strong>' . $key . '</strong>: ' . $value; } return implode('<br/>', $text); }
/** * {@inheritdoc} */ public function prepareCache(NotificationInterface $notification) { $idList = $notification->getResourceIdList(); $count = count($idList); // If the 'titles' variable is cached, rendering will be backend queries // free and fast enough to render, this is the whole goal behing this // class existence $titles = $this->getTitles($idList); $args = ['@id' => $this->getTitleString($idList, $count), '@title' => $this->getTitleString($titles, $count), '@count' => $count]; list($singular, $plural) = $this->getVariations($notification, $args); return ['_s' => $singular, '_p' => $plural, '_c' => $count, '_a' => $args, '_u' => $this->getImageURI($notification)]; }