Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Severity.php
Go to the documentation of this file.
1 <?php
9 
11 
12 class Severity extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
13 {
17  protected $_notice;
18 
24  public function __construct(
25  \Magento\Backend\Block\Context $context,
26  \Magento\AdminNotification\Model\Inbox $notice,
27  array $data = []
28  ) {
29  parent::__construct($context, $data);
30  $this->_notice = $notice;
31  }
32 
39  public function render(\Magento\Framework\DataObject $row)
40  {
41  $class = '';
42  $value = '';
43 
44  switch ($row->getData($this->getColumn()->getIndex())) {
46  $class = 'critical';
47  $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_CRITICAL);
48  break;
50  $class = 'major';
51  $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_MAJOR);
52  break;
54  $class = 'minor';
55  $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_MINOR);
56  break;
58  $class = 'notice';
59  $value = $this->_notice->getSeverities(MessageInterface::SEVERITY_NOTICE);
60  break;
61  }
62  return '<span class="grid-severity-' . $class . '"><span>' . $value . '</span></span>';
63  }
64 }
__construct(\Magento\Backend\Block\Context $context, \Magento\AdminNotification\Model\Inbox $notice, array $data=[])
Definition: Severity.php:24
render(\Magento\Framework\DataObject $row)
Definition: Severity.php:39
$_option $_optionId $class
Definition: date.phtml:13
$value
Definition: gender.phtml:16