Skip to content

Commit

Permalink
#9236: remove the usage of the json data helper
Browse files Browse the repository at this point in the history
 - replace the json data help in the AdminNotification Messages block
  • Loading branch information
dmanners committed Mar 29, 2018
1 parent 452710d commit cdca73b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/code/Magento/AdminNotification/Block/System/Messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,34 @@ class Messages extends \Magento\Backend\Block\Template

/**
* @var \Magento\Framework\Json\Helper\Data
* @deprecated
*/
protected $jsonHelper;

/**
* @var \Magento\Framework\Serialize\Serializer\Json
*/
private $serializer;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\Synchronized $messages
* @param \Magento\Framework\Json\Helper\Data $jsonHelper
* @param array $data
* @param \Magento\Framework\Serialize\Serializer\Json|null $serializer
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\Synchronized $messages,
\Magento\Framework\Json\Helper\Data $jsonHelper,
array $data = []
array $data = [],
\Magento\Framework\Serialize\Serializer\Json $serializer = null
) {
$this->jsonHelper = $jsonHelper;
parent::__construct($context, $data);
$this->_messages = $messages;
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Serialize\Serializer\Json::class);
}

/**
Expand Down Expand Up @@ -117,7 +127,7 @@ protected function _getMessagesUrl()
*/
public function getSystemMessageDialogJson()
{
return $this->jsonHelper->jsonEncode(
return $this->serializer->serialize(
[
'systemMessageDialog' => [
'buttons' => [],
Expand Down

0 comments on commit cdca73b

Please sign in to comment.