getting issue while using loadModules in our twig file

Viewed 87

I am getting issue while using loadModules in the twig file, getting error loadModules is not defined I don't know what I am doing wrong. I am configuring the route correctly. from controller.

/**
     * @Route(
            "/products/add", 
            name="wk_customer_frontend_seller_add_product",
            defaults={"type": "storefront"},
            methods={"GET", "POST"}
        )
     * @Layout
     *
     * @param Request $request
     * @return array|RedirectResponse
     */

in layout.yml

layout:
    imports:
        -
            id: oro_customer_page

    actions:
        - '@setBlockTheme':
            themes: 'WebkulMarketplaceBundle:Product:createStepOne.html.twig'

        - '@add':
            id: main_content_add_product
            parentId: page_content
            blockType: body
            options:
                attr:
                    entity: '=data["entity"]'
                    form: '=data["form"]'
                    isWidgetContext: '=data["isWidgetContext"]'
                    src: '="layout-build/" ~ context["theme"] ~ "/app.js"'
                    publicPath: '="layout-build/" ~ context["theme"] ~ "/"'

now in twig file I am calling like this.

<script type="text/javascript">
      loadModules(['jquery'], function ($) {
          $('select[name^="oro_product_step_one[type]"] option[value="configurable"]').remove();
      });
</script>

please help me as I have tried all the things I can do, but still getting the issue.

1 Answers
Related