Skip to main content

How to get the protected property from core module to custom module in magnetomagento 2

added 649 characters in body
Source Link
Jaisa
  • 2.6k
  • 10
  • 56
  • 122

I have created the block file which extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray from Module-Config. Now I need to get Protected property from the above core file. Please provide me a solution

\Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray

 public function addColumn($name, $params)
        {
            $this->_columns[$name] = [
                'label' => $this->_getParam($params, 'label', 'Column'),
                'size' => $this->_getParam($params, 'size', false),
                'style' => $this->_getParam($params, 'style'),
                'class' => $this->_getParam($params, 'class'),
                'renderer' => false,
            ];
            if (!empty($params['renderer']) && $params['renderer'] instanceof \Magento\Framework\View\Element\AbstractBlock) {
                $this->_columns[$name]['renderer'] = $params['renderer'];
            }
        }

I need to get "_columns" to my custom template System.xml

<field id="fieldslide" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Small image</label>
                    <frontend_model>X\Y\Block\Adminhtml\System\Config</frontend_model>
                    <backend_model>Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</backend_model>                    
                    <comment>Image size should be in Bytes(1 KB = 1024 Bytes, 10 KB = 10240 Bytes, 50 KB = 51200 Bytes, 100 KB = 102400 Bytes, 150 KB = 153600 Bytes)</comment>
                </field>

I have created the block file which extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray from Module-Config. Now I need to get Protected property from the above core file. Please provide me a solution

\Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray

 public function addColumn($name, $params)
        {
            $this->_columns[$name] = [
                'label' => $this->_getParam($params, 'label', 'Column'),
                'size' => $this->_getParam($params, 'size', false),
                'style' => $this->_getParam($params, 'style'),
                'class' => $this->_getParam($params, 'class'),
                'renderer' => false,
            ];
            if (!empty($params['renderer']) && $params['renderer'] instanceof \Magento\Framework\View\Element\AbstractBlock) {
                $this->_columns[$name]['renderer'] = $params['renderer'];
            }
        }

I need to get "_columns" to my custom template

I have created the block file which extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray from Module-Config. Now I need to get Protected property from the above core file. Please provide me a solution

\Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray

 public function addColumn($name, $params)
        {
            $this->_columns[$name] = [
                'label' => $this->_getParam($params, 'label', 'Column'),
                'size' => $this->_getParam($params, 'size', false),
                'style' => $this->_getParam($params, 'style'),
                'class' => $this->_getParam($params, 'class'),
                'renderer' => false,
            ];
            if (!empty($params['renderer']) && $params['renderer'] instanceof \Magento\Framework\View\Element\AbstractBlock) {
                $this->_columns[$name]['renderer'] = $params['renderer'];
            }
        }

I need to get "_columns" to my custom template System.xml

<field id="fieldslide" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
                    <label>Small image</label>
                    <frontend_model>X\Y\Block\Adminhtml\System\Config</frontend_model>
                    <backend_model>Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</backend_model>                    
                    <comment>Image size should be in Bytes(1 KB = 1024 Bytes, 10 KB = 10240 Bytes, 50 KB = 51200 Bytes, 100 KB = 102400 Bytes, 150 KB = 153600 Bytes)</comment>
                </field>
added 840 characters in body
Source Link
Jaisa
  • 2.6k
  • 10
  • 56
  • 122

I have created the block file which extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray from Module-Config. Now I need to get Protected property from the above core file. Please provide me a solution

\Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray

 public function addColumn($name, $params)
        {
            $this->_columns[$name] = [
                'label' => $this->_getParam($params, 'label', 'Column'),
                'size' => $this->_getParam($params, 'size', false),
                'style' => $this->_getParam($params, 'style'),
                'class' => $this->_getParam($params, 'class'),
                'renderer' => false,
            ];
            if (!empty($params['renderer']) && $params['renderer'] instanceof \Magento\Framework\View\Element\AbstractBlock) {
                $this->_columns[$name]['renderer'] = $params['renderer'];
            }
        }

I need to get "_columns" to my custom template

I have created the block file which extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray from Module-Config. Now I need to get Protected property from the above core file. Please provide me a solution

I have created the block file which extends \Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray from Module-Config. Now I need to get Protected property from the above core file. Please provide me a solution

\Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray

 public function addColumn($name, $params)
        {
            $this->_columns[$name] = [
                'label' => $this->_getParam($params, 'label', 'Column'),
                'size' => $this->_getParam($params, 'size', false),
                'style' => $this->_getParam($params, 'style'),
                'class' => $this->_getParam($params, 'class'),
                'renderer' => false,
            ];
            if (!empty($params['renderer']) && $params['renderer'] instanceof \Magento\Framework\View\Element\AbstractBlock) {
                $this->_columns[$name]['renderer'] = $params['renderer'];
            }
        }

I need to get "_columns" to my custom template

Source Link
Jaisa
  • 2.6k
  • 10
  • 56
  • 122
Loading