0

In reference to this Post Magento 2: Add html instead of Ui from field?

I would like on my form to display the products, the image, name of the product associated with this video on the screen. I have a column called product_id that stores the products as a text /may change it to a json object. So product_id field looks like this (1,4)

This is what I have so far using the stack example above but it only gets me html. I know there is going to be way more involved here. How do i pass the product id to my function? then format and return it back to the page.

        <field name="product_id">
            <argument name="data" xsi:type="array">
                <item name="config" xsi:type="array">
                    <item name="sortOrder" xsi:type="number">150</item>
                    <item name="dataType" xsi:type="string">text</item>
                    <item name="template" xsi:type="string">ui/form/field</item>
                    <item name="elementTmpl" xsi:type="string">Heartfelt_Videos/form/elements/Product</item>
                    <item name="formElement" xsi:type="string">input</item>
                    <item name="source" xsi:type="string">popup</item>
                    <item name="dataScope" xsi:type="string">click</item>
                </item>
            </argument>
        </field>

Then my form/elements/product.html

<div>Image -- Product Name<br>Image -- Product Name</div>

Thank you, I appreciate any help you can provide.

Your Answer

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

Browse other questions tagged or ask your own question.