Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BundleCustomOptions.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
20  public function modifyMeta(array $meta)
21  {
22  if ($groupCode = $this->getGroupCodeByField($meta, CustomOptions::CONTAINER_HEADER_NAME)) {
23  $meta[$groupCode]['children']['message'] = $this->getErrorMessage(0);
24 
25  if (!empty($meta[$groupCode]['children'][CustomOptions::CONTAINER_HEADER_NAME])) {
26  $meta = $this->modifyCustomOptionsButton(
27  $meta,
28  $groupCode,
31  );
32  $meta = $this->modifyCustomOptionsButton(
33  $meta,
34  $groupCode,
37  );
38  }
39  }
40 
41  return $meta;
42  }
43 
53  public function modifyCustomOptionsButton(array $meta, $group, $container, $button)
54  {
55  if (!empty($meta[$group]['children'][$container]['children'][$button])) {
56  $meta[$group]['children'][$container]['children'][$button]['arguments']['data']['config']['imports'] = [
57  'visible' => '!ns = ${ $.ns }, index = ' . BundlePrice::CODE_PRICE_TYPE . ':checked',
58  ];
59  }
60  return $meta;
61  }
62 
69  public function getErrorMessage($sortOrder)
70  {
71  return [
72  'arguments' => [
73  'data' => [
74  'config' => [
75  'component' => 'Magento_Ui/js/form/components/html',
76  'componentType' => Container::NAME,
77  'additionalClasses' => 'message message-error',
78  'content' => __('We can\'t save custom-defined options for bundles with dynamic pricing.'),
79  'sortOrder' => $sortOrder,
80  'imports' => [
81  'visible' => 'ns = ${ $.ns }, index = ' . BundlePrice::CODE_PRICE_TYPE . ':checked',
82  ],
83  ],
84  ],
85  ],
86  ];
87  }
88 
92  public function modifyData(array $data)
93  {
94  return $data;
95  }
96 }
$group
Definition: sections.phtml:16
__()
Definition: __.php:13