Magento2: Multiple <depends> parameters in widget.xml not allowed

Created on 29 May 2017  路  9Comments  路  Source: magento/magento2


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>

MMNY17 Fixed in 2.3.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x Reproduced on 2.3.x

Most helpful comment

I'm working on it #SQUASHTOBERFEST

All 9 comments

@milansimek thank you for your report.
Please identify which version of Magento you are running.

Magento 2.x

@milansimek, thank you for your report.
We've created internal ticket(s) MAGETWO-75743 to track progress on the issue.

I'm working on it #SQUASHTOBERFEST

Internal ticket to track issue progress: MAGETWO-81993

The issue has been fixed and delivered to 2.2-develop branch. Will be available in 2.2.2 release

Hi @milansimek. Thank you for your report.
The issue has been fixed in magento-engcom/magento2ce#1283 by @magento-engcom-team in 2.3-develop branch
Related commit(s):

  • 074285735cd6d33fd530302390ab8101e73d7e34
  • fde512eacfce36508bcec2b1c08ef381d0af3f92
  • e7d90de918be70731e2021dee757d1e7af374ab8
  • 6d4f36db79a9bee553b4acfe8c0820b5c046e6af
  • 2e83a36fbf3201bdaf6612dcfce08125687f0e28
  • 23b4aa11f5a4a0b6bfe76cd1e812d36d88ed4d83
  • b50bfa811876af007426b734019fd149def63bba
  • 04cd60da14a87727768165942c23fc1403016e41
  • 75d5a0522e8a18c2f403ea284d62e445e3d6ddc2
  • 5e02b15fcbe310cd13e385d0ae7a3e6017b56497
  • aad5ba6236ca8557072f62db524b23d68eae5de3
  • 3e321401374a7f2292bd3b2c4540db2c0af34216
  • 7898946b7ec40999b2007ee377d6b6312a3778b3
  • a173e1cd160b1d7cd24a855420317fdd7bfd9624
  • 41d0075104cb628ec1806130b6449929e8585997
  • dda19b2f6eff23e0904673fe7719c3fd935aed02
  • cba48cdfedc500b652deee50e3a3dc95e366eca3
  • 0c62caaf80c9659530d0c3dd0741108d1b0dadb0
  • 736f783b1b2fd361fb8328fd7c5cf9e7c3c172e2
  • 7569b7002878019a115aa2ea587d476a282fcd17

The fix will be available with the upcoming patch release.

@magento-engcom-team Great to hear so!

Was this page helpful?
0 / 5 - 0 ratings