![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/Ecombricks/InventoryConfig/Plugin/Model/Config/Structure/ |
<?php /** * Copyright © eComBricks. All rights reserved. * See COPYING.txt for license details. */ namespace Ecombricks\InventoryConfig\Plugin\Model\Config\Structure; /** * Abstract config structure element model plugin */ class AbstractElement extends \Ecombricks\Framework\Plugin\AbstractPlugin { /** * Get data * * @param string $key * @return mixed */ protected function getData($key) { $data = $this->getSubject()->getData(); return array_key_exists($key, $data)? $data[$key] : null; } /** * Check if enabled for source * * @return bool */ protected function isEnabledForSource() { return $this->getData('enabledForSource') === 'true'; } /** * Check if enabled for source only * * @return bool */ protected function isEnabledForSourceOnly() { return $this->getData('enabledForSourceOnly') === 'true'; } /** * Around is visible * * @param \Magento\Config\Model\Config\Structure\AbstractElement $subject * @param \Closure $proceed * @return string */ public function aroundIsVisible( \Magento\Config\Model\Config\Structure\AbstractElement $subject, \Closure $proceed ) { $this->setSubject($subject); if ($subject->getSourceCode() && !$this->isEnabledForSource()) { return false; } if (!$subject->getSourceCode() && $this->isEnabledForSourceOnly()) { return false; } return $proceed(); } }