Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ToolbarEntry.php
Go to the documentation of this file.
1 <?php
8 
17 {
22 
27 
32 
38  protected $_notificationList;
39 
45  public function __construct(
46  \Magento\Backend\Block\Template\Context $context,
47  \Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread $notificationList,
48  array $data = []
49  ) {
50  parent::__construct($context, $data);
51  $this->_notificationList = $notificationList;
52  }
53 
60  {
62  }
63 
69  public function getNotificationCounterMax()
70  {
72  }
73 
79  public function getUnreadNotificationCount()
80  {
81  return $this->_notificationList->getSize();
82  }
83 
89  public function getLatestUnreadNotifications()
90  {
91  return $this->_notificationList->setPageSize(self::NOTIFICATIONS_NUMBER);
92  }
93 
100  public function formatNotificationDate($dateString)
101  {
102  $date = new \DateTime($dateString);
103  if ($date == new \DateTime('today')) {
104  return $this->_localeDate->formatDateTime(
105  $date,
106  \IntlDateFormatter::NONE,
107  \IntlDateFormatter::SHORT
108  );
109  }
110  return $this->_localeDate->formatDateTime(
111  $date,
112  \IntlDateFormatter::MEDIUM,
113  \IntlDateFormatter::MEDIUM
114  );
115  }
116 }
__construct(\Magento\Backend\Block\Template\Context $context, \Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread $notificationList, array $data=[])
getNotificationCounterMax()
const NOTIFICATIONS_COUNTER_MAX
const NOTIFICATION_DESCRIPTION_LENGTH
getLatestUnreadNotifications()
$_notificationList
const NOTIFICATIONS_NUMBER
getNotificationDescriptionLength()
getUnreadNotificationCount()
formatNotificationDate($dateString)