Skip to content

Commit

Permalink
ENGCOM-4084: Add the ability to disable/remove an action from Mass(Tr…
Browse files Browse the repository at this point in the history
…ee)Action #20881
  • Loading branch information
sidolov authored Feb 14, 2019
2 parents 6da7fbf + ed95f81 commit 1fef35d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/code/Magento/Ui/Component/MassAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace Magento\Ui\Component;

/**
* Mass action UI component.
*
* @api
* @since 100.0.2
*/
Expand All @@ -21,7 +23,12 @@ public function prepare()
$config = $this->getConfiguration();

foreach ($this->getChildComponents() as $actionComponent) {
$config['actions'][] = $actionComponent->getConfiguration();
$componentConfig = $actionComponent->getConfiguration();
$disabledAction = $componentConfig['actionDisable'] ?? false;
if ($disabledAction) {
continue;
}
$config['actions'][] = $componentConfig;
}

$origConfig = $this->getConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<item name="label" type="string" translate="true" xsi:type="xpath">settings/label</item>
<item name="type" type="string" xsi:type="xpath">settings/type</item>
<item name="url" type="url" xsi:type="converter">settings/url</item>
<item name="actionDisable" type="boolean" xsi:type="xpath">settings/actionDisable</item>
<item name="confirm" xsi:type="array">
<item name="title" type="string" translate="true" xsi:type="xpath">settings/confirm/title</item>
<item name="message" type="string" translate="true" xsi:type="xpath">settings/confirm/message</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="actionDisable" type="xs:boolean">
<xs:annotation>
<xs:documentation>
Disable and remove this action.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:attribute name="name" use="required"/>
</xs:complexType>
Expand Down Expand Up @@ -82,6 +89,13 @@
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="actionDisable" type="xs:boolean">
<xs:annotation>
<xs:documentation>
Disable and remove this action.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="confirm" type="confirmType">
<xs:annotation>
<xs:documentation>
Expand Down

0 comments on commit 1fef35d

Please sign in to comment.