![]() 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/old/vendor/amasty/feed/Block/Adminhtml/Feed/Edit/Tab/ |
<?php /** * @author Amasty Team * @copyright Copyright (c) Amasty (https://www.amasty.com) * @package Product Feed for Magento 2 */ namespace Amasty\Feed\Block\Adminhtml\Feed\Edit\Tab; use Amasty\Feed\Model\Rule\Rule; use Magento\Backend\Block\Widget\Form; use Magento\Backend\Block\Widget\Form\Generic; use Magento\Backend\Block\Widget\Tab\TabInterface; class Conditions extends Generic implements TabInterface { /** * @var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset */ private $rendererFieldset; /** * @var \Magento\Rule\Block\Conditions */ private $conditions; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Registry $registry * @param \Magento\Framework\Data\FormFactory $formFactory * @param \Magento\Rule\Block\Conditions $conditions * @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Data\FormFactory $formFactory, \Magento\Rule\Block\Conditions $conditions, \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset, array $data = [] ) { $this->rendererFieldset = $rendererFieldset; $this->conditions = $conditions; parent::__construct($context, $registry, $formFactory, $data); } /** * Prepare content for tab * * @return \Magento\Framework\Phrase * @codeCoverageIgnore */ public function getTabLabel() { return __('Conditions'); } /** * Prepare title for tab * * @return \Magento\Framework\Phrase * @codeCoverageIgnore */ public function getTabTitle() { return __('Conditions'); } /** * Returns status flag about this tab can be showen or not * * @return bool * @codeCoverageIgnore */ public function canShowTab() { return true; } /** * Returns status flag about this tab hidden or not * * @return bool * @codeCoverageIgnore */ public function isHidden() { return false; } /** * @return Form */ protected function _prepareForm() { /** @var Rule $model */ $model = $this->_coreRegistry->registry('current_amfeed_rule'); /** @var \Magento\Framework\Data\Form $form */ $form = $this->_formFactory->create(); $form->setHtmlIdPrefix('rule_'); $renderer = $this->rendererFieldset->setTemplate( 'Magento_CatalogRule::promo/fieldset.phtml' )->setNameInLayout( $this->getNameInLayout() . '_renderer' )->setNewChildUrl( $this->getUrl('amfeed/feed/newConditionHtml/form/rule_conditions_fieldset') ); $fieldset = $form->addFieldset( 'conditions_fieldset', ['legend' => __('Conditions (don\'t add conditions if need export all products)')] )->setRenderer( $renderer ); $fieldset->addField( 'conditions', 'text', [ 'name' => 'conditions', 'label' => __('Conditions'), 'title' => __('Conditions'), 'required' => true ] )->setRule( $model )->setRenderer( $this->conditions ); $form->setValues($model->getData()); $this->setForm($form); return parent::_prepareForm(); } }