From 614f77a8d402ae13a58544709264588968dc1257 Mon Sep 17 00:00:00 2001 From: Alex Dong Date: Tue, 31 Oct 2023 23:30:23 +0700 Subject: [PATCH] Clean code --- Block/Adminhtml/Magicslider/Grid.php | 2 +- .../Magicslider/Helper/Grid/Image.php | 3 +-- .../Magicslider/Helper/Grid/Snippet.php | 19 +++++++++---------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Block/Adminhtml/Magicslider/Grid.php b/Block/Adminhtml/Magicslider/Grid.php index 220aa01..39f39a3 100644 --- a/Block/Adminhtml/Magicslider/Grid.php +++ b/Block/Adminhtml/Magicslider/Grid.php @@ -261,7 +261,7 @@ public function toHtml() document.querySelectorAll(".copy-to-clipboard").forEach((button) => { button.addEventListener("click", function(e){ e.stopPropagation(); - var copyInput = button.closest(".magicslider-snippet").querySelector(".copy-input"); + var copyInput = button.closest(".magiccart-snippet").querySelector(".copy-input"); copyInput.type = "text"; copyInput.select(); copyInput.setSelectionRange(0, 99999); diff --git a/Block/Adminhtml/Magicslider/Helper/Grid/Image.php b/Block/Adminhtml/Magicslider/Helper/Grid/Image.php index 4693f4e..10903c9 100644 --- a/Block/Adminhtml/Magicslider/Helper/Grid/Image.php +++ b/Block/Adminhtml/Magicslider/Helper/Grid/Image.php @@ -23,12 +23,11 @@ class Image extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractR /** * Magicslider factory. * - * @var \Magestore\Magicslider\Model\MagicsliderFactory + * @var \Magiccart\Magicslider\Model\MagicsliderFactory */ protected $_magicsliderFactory; /** - * [__construct description]. * * @param \Magento\Backend\Block\Context $context * @param \Magento\Store\Model\StoreManagerInterface $storeManager diff --git a/Block/Adminhtml/Magicslider/Helper/Grid/Snippet.php b/Block/Adminhtml/Magicslider/Helper/Grid/Snippet.php index 87569ee..dd991b9 100644 --- a/Block/Adminhtml/Magicslider/Helper/Grid/Snippet.php +++ b/Block/Adminhtml/Magicslider/Helper/Grid/Snippet.php @@ -20,17 +20,16 @@ class Snippet extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstrac * * @var \Magento\Store\Model\StoreManagerInterface */ - protected $_storeManager; + protected $storeManager; /** * Magicslider factory. * - * @var \Magestore\Magicslider\Model\MagicsliderFactory + * @var \Magiccart\Magicslider\Model\MagicsliderFactory */ - protected $_magicsliderFactory; + protected $magicsliderFactory; /** - * [__construct description]. * * @param \Magento\Backend\Block\Context $context * @param \Magento\Store\Model\StoreManagerInterface $storeManager @@ -44,8 +43,8 @@ public function __construct( array $data = [] ) { parent::__construct($context, $data); - $this->_storeManager = $storeManager; - $this->_magicsliderFactory = $magicsliderFactory; + $this->storeManager = $storeManager; + $this->magicsliderFactory = $magicsliderFactory; } /** @@ -58,13 +57,13 @@ public function __construct( public function render(\Magento\Framework\DataObject $row) { $storeViewId = $this->getRequest()->getParam('store'); - $item = $this->_magicsliderFactory->create()->setStoreViewId($storeViewId)->load($row->getId()); + $item = $this->magicsliderFactory->create()->setStoreViewId($storeViewId)->load($row->getId()); $identifier = $item->getIdentifier(); $shortcodeWidget = $this->_escaper->escapeHtml('{{widget type="Magiccart\Magicslider\Block\Widget\Slider" identifier="' . $identifier . '" template="magicslider.phtml"}}'); $shortcodeBlock = $this->_escaper->escapeHtml('getLayout()->createBlock(\'Magiccart\Magicslider\Block\Widget\Slider\')->setIdentifier("' . $identifier . '")->setTemplate(\'magicslider.phtml\')->toHtml(); ?>'); - $iconSvg = ''; - $html = '
'; - $html .= '
'; + $emojiCopy = '✂️'; + $html = '
'; + $html .= '
'; return $html; }