示例#1
0
 /**
  * {@inheritdoc}
  */
 public function modifyMeta(array $meta)
 {
     if ($this->locator->getProduct()->getTypeId() === static::PRODUCT_TYPE_GROUPED) {
         $meta = $this->arrayManager->remove(CustomOptionsModifier::GROUP_CUSTOM_OPTIONS_NAME, $meta);
     }
     return $meta;
 }
示例#2
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
  */
 public function modifyMeta(array $meta)
 {
     $path = $this->arrayManager->findPath(static::CODE_BUNDLE_DATA, $meta, null, 'children');
     $meta = $this->arrayManager->merge($path, $meta, ['arguments' => ['data' => ['config' => ['dataScope' => '', 'opened' => true, 'sortOrder' => $this->getNextGroupSortOrder($meta, static::GROUP_CONTENT, static::SORT_ORDER)]]], 'children' => ['modal' => ['arguments' => ['data' => ['config' => ['isTemplate' => false, 'componentType' => Modal::NAME, 'dataScope' => '', 'provider' => 'product_form.product_form_data_source', 'options' => ['title' => __('Add Products to Option'), 'buttons' => [['text' => __('Cancel'), 'actions' => ['closeModal']], ['text' => __('Add Selected Products'), 'class' => 'action-primary', 'actions' => [['targetName' => 'index = bundle_product_listing', 'actionName' => 'save'], 'closeModal']]]]]]], 'children' => ['bundle_product_listing' => ['arguments' => ['data' => ['config' => ['autoRender' => false, 'componentType' => 'insertListing', 'dataScope' => 'bundle_product_listing', 'externalProvider' => 'bundle_product_listing.bundle_product_listing_data_source', 'selectionsProvider' => 'bundle_product_listing.bundle_product_listing.product_columns.ids', 'ns' => 'bundle_product_listing', 'render_url' => $this->urlBuilder->getUrl('mui/index/render'), 'realTimeLink' => false, 'dataLinks' => ['imports' => false, 'exports' => true], 'behaviourType' => 'simple', 'externalFilterMode' => true]]]]]], self::CODE_AFFECT_BUNDLE_PRODUCT_SELECTIONS => ['arguments' => ['data' => ['config' => ['componentType' => Form\Field::NAME, 'dataType' => Form\Element\DataType\Text::NAME, 'formElement' => Form\Element\Input::NAME, 'dataScope' => 'data.affect_bundle_product_selections', 'visible' => false, 'value' => '1']]]], self::CODE_BUNDLE_HEADER => $this->getBundleHeader(), self::CODE_BUNDLE_OPTIONS => $this->getBundleOptions()]]);
     //TODO: Remove this workaround after MAGETWO-49902 is fixed
     $bundleItemsGroup = $this->arrayManager->get($path, $meta);
     $meta = $this->arrayManager->remove($path, $meta);
     $meta = $this->arrayManager->set($path, $meta, $bundleItemsGroup);
     $meta = $this->modifyShipmentType($meta);
     return $meta;
 }
 /**
  * Customize date range field if from and to fields belong to one group
  *
  * @param array $meta
  * @return array
  */
 protected function customizeDateRangeField(array $meta)
 {
     if ($this->getGroupCodeByField($meta, self::CODE_CUSTOM_DESIGN_FROM) !== $this->getGroupCodeByField($meta, self::CODE_CUSTOM_DESIGN_TO)) {
         return $meta;
     }
     $fromFieldPath = $this->arrayManager->findPath(self::CODE_CUSTOM_DESIGN_FROM, $meta, null, 'children');
     $toFieldPath = $this->arrayManager->findPath(self::CODE_CUSTOM_DESIGN_TO, $meta, null, 'children');
     $fromContainerPath = $this->arrayManager->slicePath($fromFieldPath, 0, -2);
     $toContainerPath = $this->arrayManager->slicePath($toFieldPath, 0, -2);
     $meta = $this->arrayManager->merge($fromFieldPath . self::META_CONFIG_PATH, $meta, ['label' => __('Schedule Update From'), 'additionalClasses' => 'admin__field-date']);
     $meta = $this->arrayManager->merge($toFieldPath . self::META_CONFIG_PATH, $meta, ['label' => __('To'), 'scopeLabel' => null, 'additionalClasses' => 'admin__field-date']);
     $meta = $this->arrayManager->merge($fromContainerPath . self::META_CONFIG_PATH, $meta, ['label' => __('Schedule Update From'), 'additionalClasses' => 'admin__control-grouped-date', 'breakLine' => false, 'component' => 'Magento_Ui/js/form/components/group']);
     $meta = $this->arrayManager->set($fromContainerPath . '/children/' . self::CODE_CUSTOM_DESIGN_TO, $meta, $this->arrayManager->get($toFieldPath, $meta));
     return $this->arrayManager->remove($toContainerPath, $meta);
 }
 /**
  * Customize msrp display actual price field
  *
  * @return $this
  */
 protected function customizeMsrpDisplayActualPrice()
 {
     $msrpDisplayPath = $this->getElementArrayPath($this->meta, self::FIELD_MSRP_DISPLAY_ACTUAL_PRICE);
     if ($msrpDisplayPath) {
         if (!$this->msrpConfig->isEnabled()) {
             $this->meta = $this->arrayManager->remove($this->arrayManager->slicePath($msrpDisplayPath, 0, -2), $this->meta);
         }
     }
     return $this;
 }
示例#5
0
 /**
  * Customize msrp display actual price field
  *
  * @return $this
  */
 protected function customizeMsrpDisplayActualPrice()
 {
     $msrpDisplayPath = $this->arrayManager->findPath(static::FIELD_MSRP_DISPLAY_ACTUAL_PRICE, $this->meta, null, 'children');
     if ($msrpDisplayPath) {
         if (!$this->msrpConfig->isEnabled()) {
             $this->meta = $this->arrayManager->remove($this->arrayManager->slicePath($msrpDisplayPath, 0, -2), $this->meta);
         }
     }
     return $this;
 }
示例#6
0
 /**
  * Special price data move to inline group
  *
  * @return $this
  */
 protected function specialPriceDataToInline()
 {
     $pathFrom = $this->arrayManager->findPath('special_from_date', $this->meta, null, 'children');
     $pathTo = $this->arrayManager->findPath('special_to_date', $this->meta, null, 'children');
     if ($pathFrom && $pathTo) {
         $this->meta = $this->arrayManager->merge($this->arrayManager->slicePath($pathFrom, 0, -2) . '/arguments/data/config', $this->meta, ['label' => __('Special Price From'), 'additionalClasses' => 'admin__control-grouped-date', 'breakLine' => false, 'component' => 'Magento_Ui/js/form/components/group', 'scopeLabel' => $this->arrayManager->get($pathFrom . '/arguments/data/config/scopeLabel', $this->meta)]);
         $this->meta = $this->arrayManager->merge($pathFrom . '/arguments/data/config', $this->meta, ['label' => __('Special Price From'), 'scopeLabel' => null, 'additionalClasses' => 'admin__field-date']);
         $this->meta = $this->arrayManager->merge($pathTo . '/arguments/data/config', $this->meta, ['label' => __('To'), 'scopeLabel' => null, 'additionalClasses' => 'admin__field-date']);
         // Move special_to_date to special_from_date container
         $this->meta = $this->arrayManager->set($this->arrayManager->slicePath($pathFrom, 0, -1) . '/special_to_date', $this->meta, $this->arrayManager->get($pathTo, $this->meta));
         $this->meta = $this->arrayManager->remove($this->arrayManager->slicePath($pathTo, 0, -2), $this->meta);
     }
     return $this;
 }
示例#7
0
 /**
  * Customize "Set Product as New" date fields
  *
  * @param array $meta
  * @return array
  */
 protected function customizeNewDateRangeField(array $meta)
 {
     $fromField = 'news_from_date';
     $toField = 'news_to_date';
     $fromFieldPath = $this->arrayManager->findPath($fromField, $meta, null, 'children');
     $toFieldPath = $this->arrayManager->findPath($toField, $meta, null, 'children');
     if ($fromFieldPath && $toFieldPath) {
         $fromContainerPath = $this->arrayManager->slicePath($fromFieldPath, 0, -2);
         $toContainerPath = $this->arrayManager->slicePath($toFieldPath, 0, -2);
         $meta = $this->arrayManager->merge($fromFieldPath . self::META_CONFIG_PATH, $meta, ['label' => __('Set Product as New From'), 'additionalClasses' => 'admin__field-date']);
         $meta = $this->arrayManager->merge($toFieldPath . self::META_CONFIG_PATH, $meta, ['label' => __('To'), 'scopeLabel' => null, 'additionalClasses' => 'admin__field-date']);
         $meta = $this->arrayManager->merge($fromContainerPath . self::META_CONFIG_PATH, $meta, ['label' => __('Set Product as New From'), 'additionalClasses' => 'admin__control-grouped-date', 'breakLine' => false, 'component' => 'Magento_Ui/js/form/components/group']);
         $meta = $this->arrayManager->set($fromContainerPath . '/children/' . $toField, $meta, $this->arrayManager->get($toFieldPath, $meta));
         $meta = $this->arrayManager->remove($toContainerPath, $meta);
     }
     return $meta;
 }
 /**
  * @param string $path
  * @param array $data
  * @param array $result
  * @dataProvider removeDataProvider
  */
 public function testRemove($path, $data, $result)
 {
     $this->assertSame($result, $this->arrayManager->remove($path, $data));
 }