Skip to content

Multiple <depends> parameters in widget.xml not allowed #9783

Closed
@milansimek

Description

@milansimek

Preconditions

  1. Install Magento 2.x
  2. Create custom module

Steps to reproduce

  1. Create a widget.xml in your custom module and add a widget
  2. Create a parameter (field) inside parent tag widgets>widget>parameters with a <depends> tag, making it depend on the value of two other parameters as follows:
<parameter name="myfield" xsi:type="text" required="true" visible="true">
      <label translate="true">Example</label>
      <depends>
          <parameter name="dependency_one" value="1"/>
          <parameter name="dependency_two" value="1"/>
      </depends>
</parameter>

Expected result

  1. The field should be shown only when both dependencies are met

Actual result

image

Way to fix

Update magento/module-widget/etc/widget.xsd and magento/module-widget/etc/widget_file.xsd

In the bottom of the files change this:

    <xs:complexType name="dependsType">
        <xs:annotation>
            <xs:documentation>List of parameters this parameter depends on.</xs:documentation>
        </xs:annotation>
        <xs:all>
            <xs:element name="parameter" type="dependsParameterType" />
        </xs:all>
    </xs:complexType>

Into this:

    <xs:complexType name="dependsType">
        <xs:annotation>
            <xs:documentation>List of parameters this parameter depends on.</xs:documentation>
        </xs:annotation>
        <xs:sequence maxOccurs="unbounded" minOccurs="1">
            <xs:element name="parameter" type="dependsParameterType" />
        </xs:sequence>
    </xs:complexType>

Metadata

Metadata

Assignees

Labels

Event: MMNY17Fixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions