Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Statuses.php
Go to the documentation of this file.
1 <?php
9 
14 class Statuses extends \Magento\Backend\Block\Widget\Grid\Column
15 {
19  protected $_cacheTypeList;
20 
26  public function __construct(
27  \Magento\Backend\Block\Template\Context $context,
28  \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
29  array $data = []
30  ) {
31  parent::__construct($context, $data);
32  $this->_cacheTypeList = $cacheTypeList;
33  }
34 
40  public function getFrameCallback()
41  {
42  return [$this, 'decorateStatus'];
43  }
44 
55  public function decorateStatus($value, $row, $column, $isExport)
56  {
57  $invalidedTypes = $this->_cacheTypeList->getInvalidated();
58  if (isset($invalidedTypes[$row->getId()])) {
59  $cell = '<span class="grid-severity-minor"><span>' . __('Invalidated') . '</span></span>';
60  } else {
61  if ($row->getStatus()) {
62  $cell = '<span class="grid-severity-notice"><span>' . $value . '</span></span>';
63  } else {
64  $cell = '<span class="grid-severity-critical"><span>' . $value . '</span></span>';
65  }
66  }
67  return $cell;
68  }
69 }
__()
Definition: __.php:13
$value
Definition: gender.phtml:16
decorateStatus($value, $row, $column, $isExport)
Definition: Statuses.php:55
__construct(\Magento\Backend\Block\Template\Context $context, \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList, array $data=[])
Definition: Statuses.php:26