문제

I've checked the example here: https://devdocs.magento.com/guides/v2.3/ext-best-practices/tutorials/dynamic-row-system-config.html

Which add text inputs, But how to add other types of input such as drop down and file upload?

도움이 되었습니까?

해결책

Not fully answered the question but it helps to point in the right direction;

Under Class: Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray You can overwrite on you custom class the method responsible to rendering the html input:look for renderCellTemplate Method:

As a test I have overwritten by simply changing from: type="text" to: type="checkbox" and The result is: enter image description here

All it need to do is add html <select> and <option> html and that should do.

UPDATE: I've made use of renderer here is an example from Braintree module.

/**
     * Returns renderer for country element
     *
     * @return Countries
     */
    protected function getCountryRenderer()
    {
        if (!$this->countryRenderer) {
            $this->countryRenderer = $this->getLayout()->createBlock(
                Countries::class,
                '',
                ['data' => ['is_render_to_js_template' => true]]
            );
        }
        return $this->countryRenderer;
    }

The above is rendering the countries drop down but I am loading the categories. finale look like this: enter image description here Best!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top