8

I am working on a custom module where I want to add the following field in my admin form

in have my admin form developed in using ui_component I want to add this field (in this picture) after a field

<field name="slider_type">
            <argument name="data" xsi:type="array">
                <item name="options" xsi:type="object">vendor\modulename\Model\Config\Source\ProductType</item>
                <item name="config" xsi:type="array">
                    <item name="component" xsi:type="string">vendor_modulename/js/form/element/options</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="label" xsi:type="string" translate="true">Type</item>
                    <item name="formElement" xsi:type="string">select</item>
                    <item name="source" xsi:type="string">modulename</item>
                    <item name="dataScope" xsi:type="string">slider_type</item>
                    <item name="validation" xsi:type="array">
                        <item name="required-entry" xsi:type="boolean">true</item>
                    </item>
                </item>
            </argument>
        </field>

enter image description here

how can I add this in my admin form please help

  • Show your code then easy to help. – Sohel Rana May 14 '19 at 5:24
  • i have updated you can check now... actually i have a admin form in ui_component i want to add this feild (the one placed in widiget) to my ui_component form – Waqar Ali May 14 '19 at 5:33
0
 public function getWidgetInstance()
    {
        return $this->_coreRegistry->registry('current_vihadigitalcom_popup_items');
}
function _prepareform(){ 
 $model = $this->_coreRegistry->registry('current_vihadigitalcom_popup_items');
         $widgetInstance = $this->getWidgetInstance();

$layoutBlock = $this->getLayout()->createBlock(
            \Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Tab\Main\Layout::class
        )->setWidgetInstance(
            $widgetInstance
        );

        $fieldset = $form->addFieldset('layout_updates_fieldset', ['legend' => __('Layout Updates')]);
        $fieldset->addField('layout_updates', 'note', []);
        $form->getElement('layout_updates_fieldset')->setRenderer($layoutBlock);
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.