Statuses.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © 2015 Ihor Vansach (ihor@magefan.com). All rights reserved.
  4. * See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
  5. *
  6. * Glory to Ukraine! Glory to the heroes!
  7. */
  8. namespace Magefan\Blog\Block\Adminhtml\Grid\Column;
  9. /**
  10. * Admin blog grid statuses
  11. */
  12. class Statuses extends \Magento\Backend\Block\Widget\Grid\Column
  13. {
  14. /**
  15. * Add to column decorated status
  16. *
  17. * @return array
  18. */
  19. public function getFrameCallback()
  20. {
  21. return [$this, 'decorateStatus'];
  22. }
  23. /**
  24. * Decorate status column values
  25. *
  26. * @param string $value
  27. * @param \Magento\Framework\Model\AbstractModel $row
  28. * @param \Magento\Backend\Block\Widget\Grid\Column $column
  29. * @param bool $isExport
  30. * @return string
  31. */
  32. public function decorateStatus($value, $row, $column, $isExport)
  33. {
  34. if ($row->getIsActive() || $row->getStatus()) {
  35. $cell = '<span class="grid-severity-notice"><span>' . $value . '</span></span>';
  36. } else {
  37. $cell = '<span class="grid-severity-critical"><span>' . $value . '</span></span>';
  38. }
  39. return $cell;
  40. }
  41. }