/** * {@inheritdoc} */ public function validate($value, Constraint $constraint) { $channels = $this->manager->getChannelChoices(); if (0 === count($channels)) { throw new ConstraintDefinitionException('No channel is set in the application'); } $constraint->choices = array_keys($channels); parent::validate($value, $constraint); }
/** * Get channel choices with user channel code first * * @return string[] */ public function getChannelChoicesWithUserChannel() { $channelChoices = $this->channelManager->getChannelChoices(); $userChannelCode = $this->getUserChannelCode(); if (array_key_exists($userChannelCode, $channelChoices)) { return [$userChannelCode => $channelChoices[$userChannelCode]] + $channelChoices; } return $channelChoices; }
/** * {@inheritdoc} */ public function getConfigurationFields() { return ['channel' => ['type' => 'choice', 'options' => ['choices' => $this->channelManager->getChannelChoices(), 'required' => true, 'select2' => true, 'label' => 'pim_base_connector.export.channel.label', 'help' => 'pim_base_connector.export.channel.help']], 'updatedCondition' => ['type' => 'choice', 'options' => ['required' => true, 'select2' => true, 'label' => 'pim_enhanced_connector.product_reader.updatedCondition.label', 'help' => 'pim_enhanced_connector.product_reader.updatedCondition.help', 'choices' => ['doNotApply' => 'pim_enhanced_connector.product_reader.updatedCondition.choices.doNotApply', 'fromDefinedDate' => 'pim_enhanced_connector.product_reader.updatedCondition.choices.fromDefinedDate', 'fromLastExecution' => 'pim_enhanced_connector.product_reader.updatedCondition.choices.fromLastExecution']]], 'updatedSince' => ['options' => ['required' => false, 'label' => 'pim_enhanced_connector.product_reader.updatedSince.label', 'help' => 'pim_enhanced_connector.product_reader.updatedSince.help']], 'enabledCondition' => ['type' => 'choice', 'options' => ['required' => true, 'select2' => true, 'help' => 'pim_enhanced_connector.product_reader.enabledCondition.help', 'label' => 'pim_enhanced_connector.product_reader.enabledCondition.label', 'choices' => ['onlyEnabled' => 'pim_enhanced_connector.product_reader.enabledCondition.choices.onlyEnabled', 'onlyDisabled' => 'pim_enhanced_connector.product_reader.enabledCondition.choices.onlyDisabled', 'doNotApply' => 'pim_enhanced_connector.product_reader.enabledCondition.choices.doNotApply']]], 'categorizationCondition' => ['type' => 'choice', 'options' => ['required' => true, 'select2' => true, 'help' => 'pim_enhanced_connector.product_reader.categorizationCondition.help', 'label' => 'pim_enhanced_connector.product_reader.categorizationCondition.label', 'choices' => ['onlyCategorized' => 'pim_enhanced_connector.product_reader.categorizationCondition.choices.onlyCategorized', 'onlyNonCategorized' => 'pim_enhanced_connector.product_reader.categorizationCondition.choices.onlyNonCategorized', 'doNotApply' => 'pim_enhanced_connector.product_reader.categorizationCondition.choices.doNotApply']]], 'completeCondition' => ['type' => 'choice', 'options' => ['required' => true, 'select2' => true, 'help' => 'pim_enhanced_connector.product_reader.completeCondition.help', 'label' => 'pim_enhanced_connector.product_reader.completeCondition.label', 'choices' => ['onlyComplete' => 'pim_enhanced_connector.product_reader.completeCondition.choices.onlyComplete', 'onlyUncomplete' => 'pim_enhanced_connector.product_reader.completeCondition.choices.onlyUncomplete', 'doNotApply' => 'pim_enhanced_connector.product_reader.completeCondition.choices.doNotApply']]]]; }
/** * Get fields for the twig * * @return array */ public function getConfigurationFields() { return array_merge(parent::getConfigurationFields(), ['channel' => ['type' => 'choice', 'options' => ['choices' => $this->channelManager->getChannelChoices(), 'required' => true, 'help' => 'actualys_drupal_commerce_connector.export.channel.help', 'label' => 'actualys_drupal_commerce_connector.export.channel.label']]]); }
/** * {@inheritdoc} */ public function getConfigurationFields() { return ['channel' => ['type' => 'choice', 'options' => ['choices' => $this->channelManager->getChannelChoices(), 'required' => true, 'select2' => true, 'label' => 'pim_base_connector.export.channel.label', 'help' => 'pim_base_connector.export.channel.help']]]; }
/** * {@inheritdoc} */ public function getConfigurationFields() { return array_merge(parent::getConfigurationFields(), array('channel' => array('type' => 'choice', 'options' => array('choices' => $this->channelManager->getChannelChoices(), 'required' => true, 'select2' => true, 'label' => 'pim_base_connector.export.channel.label', 'help' => 'pim_base_connector.export.channel.help')))); }
/** * {@inheritdoc} */ public function getConfigurationFields() { return array_merge(parent::getConfigurationFields(), ['channel' => ['type' => 'choice', 'options' => ['choices' => $this->channelManager->getChannelChoices(), 'required' => true, 'help' => 'pim_magento_connector.export.channel.help', 'label' => 'pim_magento_connector.export.channel.label']], 'enabled' => ['type' => 'switch', 'options' => ['required' => true, 'help' => 'pim_magento_connector.export.enabled.help', 'label' => 'pim_magento_connector.export.enabled.label']], 'visibility' => ['type' => 'text', 'options' => ['required' => true, 'help' => 'pim_magento_connector.export.visibility.help', 'label' => 'pim_magento_connector.export.visibility.label']], 'currency' => ['type' => 'choice', 'options' => ['choices' => $this->currencyManager->getCurrencyChoices(), 'required' => true, 'help' => 'pim_magento_connector.export.currency.help', 'label' => 'pim_magento_connector.export.currency.label', 'attr' => ['class' => 'select2']]]], $this->categoryMappingMerger->getConfigurationField(), $this->attributeMappingMerger->getConfigurationField()); }
/** * {@inheritdoc} */ public function getConfigurationFields() { return array_merge(parent::getConfigurationFields(), ['channel' => ['type' => 'choice', 'options' => ['choices' => $this->channelManager->getChannelChoices(), 'required' => true, 'help' => 'pim_prestashop_connector.export.channel.help', 'label' => 'pim_prestashop_connector.export.channel.label']], 'enabled' => ['type' => 'switch', 'options' => ['required' => true, 'help' => 'pim_prestashop_connector.export.enabled.help', 'label' => 'pim_prestashop_connector.export.enabled.label']], 'visibility' => ['type' => 'text', 'options' => ['required' => true, 'help' => 'pim_prestashop_connector.export.visibility.help', 'label' => 'pim_prestashop_connector.export.visibility.label']], 'variantMemberVisibility' => ['type' => 'text', 'options' => ['required' => true, 'help' => 'pim_prestashop_connector.export.variant_member_visibility.help', 'label' => 'pim_prestashop_connector.export.variant_member_visibility.label']], 'currency' => ['type' => 'choice', 'options' => ['choices' => $this->currencyManager->getCurrencyChoices(), 'required' => true, 'help' => 'pim_prestashop_connector.export.currency.help', 'label' => 'pim_prestashop_connector.export.currency.label', 'attr' => ['class' => 'select2']]], 'smallImageAttribute' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getImageAttributeChoice(), 'help' => 'pim_prestashop_connector.export.smallImageAttribute.help', 'label' => 'pim_prestashop_connector.export.smallImageAttribute.label', 'attr' => ['class' => 'select2']]], 'baseImageAttribute' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getImageAttributeChoice(), 'help' => 'pim_prestashop_connector.export.baseImageAttribute.help', 'label' => 'pim_prestashop_connector.export.baseImageAttribute.label', 'attr' => ['class' => 'select2']]], 'thumbnailAttribute' => ['type' => 'choice', 'options' => ['choices' => $this->attributeManager->getImageAttributeChoice(), 'help' => 'pim_prestashop_connector.export.thumbnailAttribute.help', 'label' => 'pim_prestashop_connector.export.thumbnailAttribute.label', 'attr' => ['class' => 'select2']]], 'urlKey' => ['type' => 'checkbox', 'options' => ['help' => 'pim_prestashop_connector.export.urlKey.help', 'label' => 'pim_prestashop_connector.export.urlKey.label']], 'skuFirst' => ['type' => 'checkbox', 'options' => ['help' => 'pim_prestashop_connector.export.skuFirst.help', 'label' => 'pim_prestashop_connector.export.skuFirst.label']]], $this->categoryMappingMerger->getConfigurationField(), $this->attributeMappingMerger->getConfigurationField()); }
/** * {@inheritdoc} */ public function getConfigurationFields() { return array('channel' => array('type' => 'choice', 'options' => array('choices' => $this->channelManager->getChannelChoices(), 'required' => true, 'select2' => true, 'label' => 'pim_base_connector.export.channel.label', 'help' => 'pim_base_connector.export.channel.help')), 'exportFrom' => array('required' => false, 'options' => array('help' => 'dnd_magento_connector.export.exportFrom.help', 'label' => 'dnd_magento_connector.export.exportFrom.label')), 'batchExportID' => array('required' => false, 'options' => array('help' => 'dnd_magento_connector.export.batchExportID.help', 'label' => 'dnd_magento_connector.export.batchExportID.label')), 'isEnabled' => array('type' => 'switch', 'required' => false, 'options' => array('help' => 'dnd_magento_connector.export.isEnabled.help', 'label' => 'dnd_magento_connector.export.isEnabled.label')), 'isComplete' => array('type' => 'switch', 'required' => false, 'options' => array('help' => 'dnd_magento_connector.export.isComplete.help', 'label' => 'dnd_magento_connector.export.isComplete.label'))); }
/** * Test related method */ public function testGetChannelChoices() { $expectedArray = array('ecommerce' => 'Ecommerce', 'mobile' => 'Mobile'); $channelChoices = $this->manager->getChannelChoices(); $this->assertEquals($expectedArray, $channelChoices); }