/** * Retrieve latest critical item * * @return bool|\Magento\Adminnotification\Model\Inbox */ protected function _getLatestItem() { if ($this->_latestItem == null) { $items = array_values($this->_criticalCollection->getItems()); if (count($items)) { $this->_latestItem = $items[0]; } else { $this->_latestItem = false; } } return $this->_latestItem; }
/** * Init collection select * * @return \Magento\AdminNotification\Model\ResourceModel\Inbox\Collection\Unread */ protected function _initSelect() { parent::_initSelect(); $this->addFilter('is_remove', 0); $this->addFilter('is_read', 0); $this->setOrder('date_added'); return $this; }
/** * Add remove filter * * @return \Magento\AdminNotification\Model\ResourceModel\Grid\Collection|\Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection */ protected function _initSelect() { parent::_initSelect(); $this->addRemoveFilter(); return $this; }
/** * Retrieve the list of latest unread notifications * * @return \Magento\AdminNotification\Model\ResourceModel\Inbox\Collection */ public function getLatestUnreadNotifications() { return $this->_notificationList->setPageSize(self::NOTIFICATIONS_NUMBER); }