Skip to content

Invalid content was found starting with element 'depends'. No child element is expected at this point. in widget.xml #31092

Open
@DmitryFurs

Description

@DmitryFurs

Precondition (*)

Magento 2.4-develop

Summary (*)

When we use a custom block to render the input field in the widget, when placing any node after the <block, it is highlighted with error: Invalid content was found starting with element 'depends'. No child element is expected at this point.

If we change the order so that the <block is the last one, there are no errors

There is also a strange behavior when using the standard type for the input field (for example text) and use the dependency, if the dependencies are not described at the end, we get the following error: Invalid content was found starting with element 'description'. One of '{value}' is expected.

Examples (*)

image

<?xml version="1.0" encoding="UTF-8"?>
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd">
    <widget id="ecommerce_reviews" class="Ecommerce\ReviewWidget\Block\Widget">
        <label translate="true">Reviews Widget by eCommerce</label>
        <description>This widget allows you to display reviews anywhere on the site</description>
        <parameters>
            <parameter name="is_enabled" xsi:type="select" source_model="Magento\Config\Model\Config\Source\Yesno" visible="true" required="true" sort_order="10">
                <label translate="true">Is Enabled</label>
            </parameter>
            <parameter name="reviews_to_display_1" xsi:type="block" visible="true" required="true" sort_order="20">
                <label translate="true">Reviews to Display</label>
                <block class="Ecommerce\ReviewWidget\Block\Adminhtml\Widget\Parameter\Number" />
                <depends>
                    <parameter name="is_enabled" value="1" />
                </depends>
                <description translate="true">Description</description>
            </parameter>
            <parameter name="reviews_to_display_2" xsi:type="block" visible="true" required="true" sort_order="20">
                <label translate="true">Reviews to Display</label>
                <depends>
                    <parameter name="is_enabled" value="1" />
                </depends>
                <block class="Ecommerce\ReviewWidget\Block\Adminhtml\Widget\Parameter\Number" />
                <description translate="true">Description</description>
            </parameter>
            <parameter name="reviews_to_display_3" xsi:type="block" visible="true" required="true" sort_order="20">
                <label translate="true">Reviews to Display</label>
                <description translate="true">Description</description>
                <depends>
                    <parameter name="is_enabled" value="1" />
                </depends>
                <block class="Ecommerce\ReviewWidget\Block\Adminhtml\Widget\Parameter\Number" />
            </parameter>

            <parameter name="reviews_to_display_4" xsi:type="text" visible="true" required="true" sort_order="20">
                <label translate="true">Reviews to Display</label>
                <depends>
                    <parameter name="is_enabled" value="1" />
                </depends>
                <description translate="true">Description</description>
            </parameter>
            <parameter name="reviews_to_display_5" xsi:type="text" visible="true" required="true" sort_order="20">
                <label translate="true">Reviews to Display</label>
                <description translate="true">Description</description>
                <depends>
                    <parameter name="is_enabled" value="1" />
                </depends>
            </parameter>

            <parameter name="template" xsi:type="select" visible="true" required="true" sort_order="1000">
                <label translate="true">Template</label>
                <options>
                    <option name="default" value="Ecommerce_ReviewWidget::widget/default.phtml" selected="true">
                        <label translate="true">Default Template</label>
                    </option>
                </options>
            </parameter>
        </parameters>
    </widget>
</widgets>

Proposed solution


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users with no workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: WidgetIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: ready for devReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itstale issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions