/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $form->addChild($this->getElement('text_area', ['name' => 'comment', 'rows' => 5, 'cols' => 20, 'label' => $this->trans('order.label.comment')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $form->addChild($this->getElement('text_field', ['name' => '_username', 'label' => $this->trans('client.label.username')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $contactDetails = $form->addChild($this->getElement('nested_fieldset', ['name' => 'clientDetails', 'label' => $this->trans('client.heading.client_details')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'clientDetails.password', 'label' => $this->trans('client.label.new_password')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('image', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general'), 'datagrid' => $this->get('media.datagrid')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('select', ['name' => 'code', 'label' => $this->trans('currency.label.code'), 'options' => $this->repository->getCurrenciesToSelect()])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'general_settings', 'label' => $this->trans('common.fieldset.general')])); $languageData = $requiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('form.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('availability.repository'))])); $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('select', ['name' => 'code', 'label' => $this->trans('locale.label.code'), 'options' => $this->get('locale.repository')->getLocaleNames()])); $requiredData->addChild($this->getElement('select', ['name' => 'currency', 'label' => $this->trans('locale.label.currency'), 'options' => $this->get('currency.dataset.admin')->getResult('select', [], ['label_column' => 'code']), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('currency.repository'))])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]])); $requiredData->addChild($this->getElement('select', ['name' => 'folder', 'label' => $this->trans('theme.label.folder'), 'comment' => $this->trans('theme.comment.folder'), 'options' => $this->get('theme.locator')->getThemeFolders()])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('fieldset.required_data.label')])); $languageData = $requiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('fieldset.translations.label'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('order_status_group.repository'))])); $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('order_status_group.label.name')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]])); $requiredData->addChild($this->getElement('rights_table', ['name' => 'permissions', 'label' => $this->trans('user_group.label.permissions'), 'actions' => $this->getPermissionActions(), 'controllers' => $this->getPermissionTypes(), 'transformer' => $this->getRepositoryTransformer('user_group_permission', $this->get('user_group.repository'))])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function isValid(FormInterface $form) { $errors = $this->validator->validate($form->getModelData(), null, $form->getValidationGroups()); if ($errors->count()) { $this->constraintViolationMapper->mapErrorsToForm($errors, $form); return false; } return true; }
/** * {@inheritdoc} */ public function buildForm(FormInterface $unitForm) { $channelRequiredData = $unitForm->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $channelRequiredData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]])); $channelRequiredData->addChild($this->getElement('text_field', ['name' => 'url', 'label' => $this->trans('common.label.url'), 'rules' => [$this->getRule('required')]])); $unitForm->addFilter($this->getFilter('no_code')); $unitForm->addFilter($this->getFilter('trim')); $unitForm->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('select', ['name' => 'code', 'label' => $this->trans('currency.label.code'), 'options' => $this->getCurrencyRepository()->getCurrenciesToSelect(), 'default' => $this->getRequestHelper()->getCurrentCurrency()])); $requiredData->addChild($this->getElement('checkbox', ['name' => 'enabled', 'label' => $this->trans('common.label.enabled'), 'comment' => $this->trans('currency.comment.enabled')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * Adds shipping options if available for order's shipping method * * @param OrderInterface $order * @param FormInterface $form */ private function addShippingOptions(OrderInterface $order, FormInterface $form) { if ($order->hasShippingMethod()) { $provider = $this->getOptionsProvider($order->getShippingMethod()); if ($provider instanceof ShippingMethodOptionsProviderInterface) { $form->addChild($this->getElement('select', ['name' => 'shippingMethodOption', 'label' => $this->trans('order.label.shipping_method'), 'options' => ['Wybierz sklep', 'Kraków', 'Warszawa']])); } } }
/** * {@inheritdoc} */ public function buildForm(FormInterface $unitForm) { $unitRequiredData = $unitForm->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $unitTranslationData = $unitRequiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('form.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('product.repository'))])); $unitTranslationData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name')])); $unitForm->addFilter($this->getFilter('no_code')); $unitForm->addFilter($this->getFilter('trim')); $unitForm->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('text_field', ['name' => 'identifier', 'label' => $this->trans('dictionary.label.identifier')])); $languageData = $requiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('form.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('dictionary.repository'))])); $languageData->addChild($this->getElement('text_field', ['name' => 'value', 'label' => $this->trans('dictionary.label.value')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('text_field', ['name' => 'discount', 'label' => $this->trans('common.label.discount'), 'comment' => $this->trans('client.comment.discount'), 'suffix' => '%', 'filters' => [$this->getFilter('comma_to_dot_changer')], 'rules' => [$this->getRule('required')]])); $languageData = $requiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('common.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('client_group.repository'))])); $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $mainData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $mainData->addChild($this->getElement('text_field', ['name' => 'nick', 'label' => $this->trans('product_review.label.nick')])); $mainData->addChild($this->getElement('text_field', ['name' => 'rating', 'label' => $this->trans('product_review.label.rating')])); $mainData->addChild($this->getElement('text_area', ['name' => 'review', 'label' => $this->trans('product_review.label.review'), 'rows' => 5, 'cols' => 10])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $taxForm) { $taxRequiredData = $taxForm->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $taxTranslationData = $taxRequiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('common.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('tax.repository'))])); $taxTranslationData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]])); $taxRequiredData->addChild($this->getElement('text_field', ['name' => 'value', 'label' => $this->trans('tax.label.value'), 'suffix' => '%', 'rules' => [$this->getRule('required')]])); $taxForm->addFilter($this->getFilter('no_code')); $taxForm->addFilter($this->getFilter('trim')); $taxForm->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $languageData = $requiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('common.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('layout_box.repository'))])); $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('layout_box.label.name'), 'rules' => [$this->getRule('required')]])); $requiredData->addChild($this->getElement('text_field', ['name' => 'identifier', 'label' => $this->trans('layout_box.label.identifier'), 'comment' => $this->trans('layout_box.comment.identifier'), 'rules' => [$this->getRule('required')]])); $requiredData->addChild($this->getElement('select', ['name' => 'boxType', 'label' => $this->trans('layout_box.label.box_type')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
private function addClientDetailsFieldset(FormInterface $form) { if (!$this->getSecurityHelper()->getCurrentClient() instanceof ClientInterface) { $clientDetails = $form->addChild($this->getElement('nested_fieldset', ['name' => 'clientDetails', 'label' => $this->trans('client.heading.client')])); $clientDetails->addChild($this->getElement('checkbox', ['name' => 'clientDetails.createAccount', 'label' => $this->trans('client.label.create_account')])); $clientDetails->addChild($this->getElement('text_field', ['name' => 'clientDetails.username', 'label' => $this->trans('client.label.username')])); $clientDetails->addChild($this->getElement('password', ['name' => 'clientDetails.hashedPassword', 'label' => $this->trans('client.label.password')])); $clientDetails->addChild($this->getElement('password', ['name' => 'clientDetails.passwordConfirm', 'label' => $this->trans('client.label.confirm_password')])); $clientDetails->addChild($this->getElement('checkbox', ['name' => 'clientDetails.conditionsAccepted', 'label' => $this->trans('client.label.conditions_accepted')])); } }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('checkbox', ['name' => 'enabled', 'label' => $this->trans('common.label.enabled'), 'comment' => $this->trans('order_status.comment.enabled'), 'default' => 1])); $orderStatusGroups = $this->get('order_status_group.dataset.admin')->getResult('select'); $requiredData->addChild($this->getElement('select', ['name' => 'orderStatusGroup', 'label' => $this->trans('order_status.label.order_status_group'), 'options' => $orderStatusGroups, 'default' => current(array_keys($orderStatusGroups)), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('order_status_group.repository'))])); $languageData = $requiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('common.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('order_status.repository'))])); $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name')])); $languageData->addChild($this->getElement('rich_text_editor', ['name' => 'defaultComment', 'label' => $this->trans('order_status.label.default_comment')])); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $repository = $this->getNewsRepository(); $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $languageData = $requiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('common.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $repository)])); $languageData->addChild($this->getElement('text_field', ['name' => 'topic', 'label' => $this->trans('news.label.topic'), 'rules' => [$this->getRule('required')]])); $languageData->addChild($this->getElement('text_area', ['name' => 'summary', 'label' => $this->trans('news.label.summary')])); $languageData->addChild($this->getElement('text_area', ['name' => 'content', 'label' => $this->trans('news.label.content')])); $this->addMetadataFieldset($form, $repository); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $requiredData->addChild($this->getElement('text_field', ['name' => 'firstName', 'label' => $this->trans('common.label.first_name')])); $requiredData->addChild($this->getElement('text_field', ['name' => 'lastName', 'label' => $this->trans('common.label.last_name')])); $requiredData->addChild($this->getElement('text_field', ['name' => 'username', 'label' => $this->trans('common.label.username')])); $requiredData->addChild($this->getElement('text_field', ['name' => 'email', 'label' => $this->trans('common.label.email')])); $requiredData->addChild($this->getElement('multi_select', ['name' => 'groups', 'label' => $this->trans('user.label.user_group'), 'options' => $this->get('user_group.dataset.admin')->getResult('select'), 'transformer' => $this->getRepositoryTransformer('collection', $this->get('user_group.repository'))])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $currencies = $this->get('currency.dataset.admin')->getResult('select', ['order_by' => 'code'], ['label_column' => 'code', 'value_column' => 'code']); $vatValues = $this->get('tax.dataset.admin')->getResult('select', ['order_by' => 'value']); $mainData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'main_data', 'label' => $this->trans('common.fieldset.general')])); $languageData = $mainData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('locale.label.language'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('product.repository'))])); $name = $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]])); $languageData->addChild($this->getElement('slug_field', ['name' => 'slug', 'label' => $this->trans('product.label.slug'), 'name_field' => $name, 'generate_route' => 'admin.routing.generate', 'translatable_id' => $this->getRequestHelper()->getAttributesBagParam('id'), 'rules' => [$this->getRule('required')]])); $mainData->addChild($this->getElement('checkbox', ['name' => 'enabled', 'label' => $this->trans('common.label.enabled'), 'comment' => $this->trans('product.comment.enabled')])); $mainData->addChild($this->getElement('text_field', ['name' => 'hierarchy', 'label' => $this->trans('common.label.hierarchy'), 'rules' => [$this->getRule('required')]])); $descriptionData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'description_data', 'label' => $this->trans('common.fieldset.description')])); $languageData = $descriptionData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('locale.label.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('product.repository'))])); $languageData->addChild($this->getElement('rich_text_editor', ['name' => 'shortDescription', 'label' => $this->trans('common.label.short_description')])); $languageData->addChild($this->getElement('rich_text_editor', ['name' => 'description', 'label' => $this->trans('common.label.description')])); $mainData->addChild($this->getElement('text_field', ['name' => 'sku', 'label' => $this->trans('common.label.sku'), 'rules' => [$this->getRule('required')]])); $mainData->addChild($this->getElement('select', ['name' => 'producer', 'label' => $this->trans('common.label.producer'), 'options' => $this->get('producer.dataset.admin')->getResult('select'), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('producer.repository'))])); $this->addMetadataFieldset($form, $this->get('product.repository')); $categoryPane = $form->addChild($this->getElement('nested_fieldset', ['name' => 'category_pane', 'label' => $this->trans('common.fieldset.categories')])); $categoriesField = $categoryPane->addChild($this->getElement('tree', ['name' => 'categories', 'label' => $this->trans('common.label.categories'), 'choosable' => false, 'selectable' => true, 'sortable' => false, 'clickable' => false, 'items' => $this->get('category.dataset.admin')->getResult('flat_tree'), 'transformer' => $this->getRepositoryTransformer('collection', $this->get('category.repository'))])); $pricePane = $form->addChild($this->getElement('nested_fieldset', ['name' => 'price_pane', 'label' => $this->trans('common.fieldset.prices')])); $buyPriceSettings = $pricePane->addChild($this->getElement('nested_fieldset', ['name' => 'buy_price_settings', 'label' => $this->trans('product.label.buy_price.settings'), 'class' => 'priceGroup'])); $buyPriceSettings->addChild($this->getElement('select', ['name' => 'buyPrice.currency', 'label' => $this->trans('common.label.currency'), 'options' => $currencies])); $buyPriceTax = $buyPriceSettings->addChild($this->getElement('select', ['name' => 'buyPriceTax', 'label' => $this->trans('common.label.tax'), 'options' => $vatValues, 'addable' => true, 'onAdd' => 'onTaxAdd', 'add_item_prompt' => $this->trans('product.label.add_tax_prompt'), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('tax.repository'))])); $buyPriceSettings->addChild($this->getElement('price_editor', ['name' => 'buyPrice.grossAmount', 'label' => $this->trans('product.label.buy_price.gross_amount'), 'filters' => [$this->getFilter('comma_to_dot_changer')], 'vat_field' => $buyPriceTax])); $sellPriceSettings = $pricePane->addChild($this->getElement('nested_fieldset', ['name' => 'sell_price_settings', 'label' => $this->trans('product.label.sell_price.settings'), 'class' => 'priceGroup'])); $sellPriceSettings->addChild($this->getElement('select', ['name' => 'sellPrice.currency', 'label' => $this->trans('common.label.currency'), 'options' => $currencies])); $sellPriceTax = $sellPriceSettings->addChild($this->getElement('select', ['name' => 'sellPriceTax', 'label' => $this->trans('common.label.tax'), 'options' => $vatValues, 'addable' => true, 'onAdd' => 'onTaxAdd', 'add_item_prompt' => $this->trans('product.label.add_tax_prompt'), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('tax.repository'))])); $sellPriceAmount = $sellPriceSettings->addChild($this->getElement('price_editor', ['name' => 'sellPrice.grossAmount', 'label' => $this->trans('product.label.sell_price.gross_amount'), 'filters' => [$this->getFilter('comma_to_dot_changer')], 'vat_field' => $sellPriceTax])); $sellPriceSettings->addChild($this->getElement('price_editor', ['name' => 'sellPrice.discountedGrossAmount', 'label' => $this->trans('common.label.discounted_price'), 'filters' => [$this->getFilter('comma_to_dot_changer')], 'vat_field' => $sellPriceTax])); $sellPriceSettings->addChild($this->getElement('date', ['name' => 'sellPrice.validFrom', 'label' => $this->trans('common.label.valid_from'), 'transformer' => new DateTransformer('m/d/Y')])); $sellPriceSettings->addChild($this->getElement('date', ['name' => 'sellPrice.validTo', 'label' => $this->trans('common.label.valid_to'), 'transformer' => new DateTransformer('m/d/Y')])); $stockData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'stock_data', 'label' => $this->trans('product.form.fieldset.stock')])); $stockData->addChild($this->getElement('text_field', ['name' => 'stock', 'label' => $this->trans('common.label.stock'), 'suffix' => $this->trans('product.label.pcs'), 'rules' => [$this->getRule('required')]])); $stockData->addChild($this->getElement('checkbox', ['name' => 'trackStock', 'label' => $this->trans('product.label.track_stock'), 'comment' => $this->trans('product.comment.track_stock')])); $stockData->addChild($this->getElement('select', ['name' => 'unit', 'label' => $this->trans('product.label.unit'), 'options' => $this->get('unit.dataset.admin')->getResult('select'), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('unit.repository'))])); $stockData->addChild($this->getElement('text_field', ['name' => 'weight', 'label' => $this->trans('common.label.dimension.weight'), 'filters' => [$this->getFilter('comma_to_dot_changer')], 'rules' => [$this->getRule('required')]])); $stockData->addChild($this->getElement('text_field', ['name' => 'dimension.width', 'label' => $this->trans('common.label.dimension.width'), 'filters' => [$this->getFilter('comma_to_dot_changer')]])); $stockData->addChild($this->getElement('text_field', ['name' => 'dimension.height', 'label' => $this->trans('common.label.dimension.height'), 'filters' => [$this->getFilter('comma_to_dot_changer')]])); $stockData->addChild($this->getElement('text_field', ['name' => 'dimension.depth', 'label' => $this->trans('common.label.dimension.depth'), 'filters' => [$this->getFilter('comma_to_dot_changer')]])); $stockData->addChild($this->getElement('text_field', ['name' => 'packageSize', 'label' => $this->trans('product.label.package_size'), 'filters' => [$this->getFilter('comma_to_dot_changer')], 'rules' => [$this->getRule('required')]])); $availabilityField = $stockData->addChild($this->getElement('select', ['name' => 'availability', 'label' => $this->trans('product.label.availability'), 'options' => $this->get('availability.dataset.admin')->getResult('select'), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('availability.repository'))])); $mediaData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'media_data', 'label' => $this->trans('product.form.fieldset.photos')])); $mediaData->addChild($this->getElement('image', ['name' => 'productPhotos', 'label' => $this->trans('product.label.photos'), 'load_route' => $this->getRouterHelper()->generateUrl('admin.media.grid'), 'upload_url' => $this->getRouterHelper()->generateUrl('admin.media.add'), 'repeat_min' => 0, 'repeat_max' => ElementInterface::INFINITE, 'transformer' => $this->getRepositoryTransformer('product_photo_collection', $this->get('media.repository')), 'session_id' => $this->getRequestHelper()->getSessionId(), 'session_name' => $this->getRequestHelper()->getSessionName()])); $statusesData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'statuses_data', 'label' => $this->trans('product.form.fieldset.statuses')])); $statusesData->addChild($this->getElement('multi_select', ['name' => 'statuses', 'label' => $this->trans('product.label.statuses'), 'options' => $this->get('product_status.dataset.admin')->getResult('select'), 'transformer' => $this->getRepositoryTransformer('collection', $this->get('product_status.repository'))])); if ($this->getAttributeGroups()->count()) { $attributesData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'attributes_data', 'label' => $this->trans('product.form.fieldset.variants')])); $attributesData->addChild($this->getElement('variant_editor', ['name' => 'variants', 'label' => $this->trans('product.label.variants'), 'suffixes' => ['+', '-', '%'], 'price_field' => $sellPriceAmount, 'vat_field' => $sellPriceTax, 'vat_values' => $vatValues, 'category_field' => $categoriesField, 'availability_field' => $availabilityField, 'availability' => $availabilityField->getOption('options'), 'transformer' => $this->getRepositoryTransformer('variant_collection', $this->get('variant.repository'))])); } $this->addShopsFieldset($form); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $mainData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $languageData = $mainData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('common.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('product_status.repository'))])); $name = $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]])); $languageData->addChild($this->getElement('slug_field', ['name' => 'slug', 'label' => $this->trans('common.label.slug'), 'name_field' => $name, 'generate_route' => 'admin.routing.generate', 'translatable_id' => $this->getRequestHelper()->getAttributesBagParam('id'), 'rules' => [$this->getRule('required')]])); $languageData->addChild($this->getElement('text_field', ['name' => 'cssClass', 'label' => $this->trans('product_status.label.css_class'), 'comment' => $this->trans('product_status.comment.css_class')])); $this->addMetadataFieldset($form, $this->get('product_status.repository')); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $contactDetails = $form->addChild($this->getElement('nested_fieldset', ['name' => 'contactDetails', 'label' => $this->trans('client.heading.contact_details')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.firstName', 'label' => $this->trans('client.label.contact_details.first_name')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.lastName', 'label' => $this->trans('client.label.contact_details.last_name')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.phone', 'label' => $this->trans('client.label.contact_details.phone')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.secondaryPhone', 'label' => $this->trans('client.label.contact_details.secondary_phone')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.email', 'label' => $this->trans('client.label.contact_details.email')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $orderStatuses = $this->get('order_status.dataset.admin')->getResult('select'); $options = []; $processors = $this->getPaymentProcessorCollection(); foreach ($processors->all() as $processor) { $processorName = $processor->getConfigurator()->getName(); $options[$processorName] = $processorName; } $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('common.fieldset.general')])); $languageData = $requiredData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('common.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('payment_method.repository'))])); $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]])); $processorType = $requiredData->addChild($this->getElement('select', ['name' => 'processor', 'label' => $this->trans('payment_method.label.processor'), 'options' => $options])); $requiredData->addChild($this->getElement('checkbox', ['name' => 'enabled', 'label' => $this->trans('common.label.enabled')])); $requiredData->addChild($this->getElement('text_field', ['name' => 'hierarchy', 'label' => $this->trans('common.label.hierarchy'), 'rules' => [$this->getRule('required')]])); $statusesData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'statuses', 'label' => $this->trans('payment_method.fieldset.order_statuses')])); $statusesData->addChild($this->getElement('select', ['name' => 'paymentPendingOrderStatus', 'label' => $this->trans('payment_method.label.payment_pending_order_status'), 'options' => $orderStatuses, 'transformer' => $this->getRepositoryTransformer('entity', $this->get('order_status.repository'))])); $statusesData->addChild($this->getElement('select', ['name' => 'paymentSuccessOrderStatus', 'label' => $this->trans('payment_method.label.payment_success_order_status'), 'options' => $orderStatuses, 'transformer' => $this->getRepositoryTransformer('entity', $this->get('order_status.repository'))])); $statusesData->addChild($this->getElement('select', ['name' => 'paymentFailureOrderStatus', 'label' => $this->trans('payment_method.label.payment_failure_order_status'), 'options' => $orderStatuses, 'transformer' => $this->getRepositoryTransformer('entity', $this->get('order_status.repository'))])); $shippingMethodsData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'shipping_methods_data', 'label' => $this->trans('payment_method.fieldset.shipping_methods')])); $shippingMethodsData->addChild($this->getElement('multi_select', ['name' => 'shippingMethods', 'label' => $this->trans('payment_method.label.shipping_methods'), 'options' => $this->get('shipping_method.dataset.admin')->getResult('select'), 'transformer' => $this->getRepositoryTransformer('collection', $this->get('shipping_method.repository'))])); $configurationData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'configuration', 'property_path' => new PropertyPath('configuration'), 'label' => $this->trans('payment_method.fieldset.processor_configuration')])); foreach ($processors->all() as $processor) { $dependency = $this->getDependency('show', ['form' => $form, 'field' => $processorType, 'condition' => new Equals($processor->getConfigurator()->getName())]); $processor->getConfigurator()->addConfigurationFields($this, $configurationData, $dependency); } $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $countries = $this->get('country.repository')->all(); $defaultCountry = $this->get('shop.context.front')->getCurrentShop()->getDefaultCountry(); $billingAddress = $form->addChild($this->getElement('nested_fieldset', ['name' => 'billingAddress', 'label' => $this->trans('client.heading.billing_address')])); $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.firstName', 'label' => $this->trans('client.label.address.first_name')])); $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.lastName', 'label' => $this->trans('client.label.address.last_name')])); $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.street', 'label' => $this->trans('client.label.address.street')])); $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.streetNo', 'label' => $this->trans('client.label.address.street_no')])); $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.flatNo', 'label' => $this->trans('client.label.address.flat_no')])); $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.postCode', 'label' => $this->trans('client.label.address.post_code')])); $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.province', 'label' => $this->trans('client.label.address.province')])); $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.city', 'label' => $this->trans('client.label.address.city')])); $billingAddress->addChild($this->getElement('select', ['name' => 'billingAddress.country', 'label' => $this->trans('client.label.address.country'), 'options' => $countries, 'default' => $defaultCountry])); $form->addChild($this->getElement('checkbox', ['name' => 'copyAddress', 'label' => $this->trans('client.label.address.copy_address')])); $shippingAddress = $form->addChild($this->getElement('nested_fieldset', ['name' => 'shippingAddress', 'label' => $this->trans('client.heading.shipping_address')])); $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.firstName', 'label' => $this->trans('client.label.address.first_name')])); $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.lastName', 'label' => $this->trans('client.label.address.last_name')])); $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.street', 'label' => $this->trans('client.label.address.street')])); $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.streetNo', 'label' => $this->trans('client.label.address.street_no')])); $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.flatNo', 'label' => $this->trans('client.label.address.flat_no')])); $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.postCode', 'label' => $this->trans('client.label.address.post_code')])); $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.province', 'label' => $this->trans('client.label.address.province')])); $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.city', 'label' => $this->trans('client.label.address.city')])); $shippingAddress->addChild($this->getElement('select', ['name' => 'shippingAddress.country', 'label' => $this->trans('client.label.address.country'), 'options' => $countries, 'default' => $defaultCountry])); $contactDetails = $form->addChild($this->getElement('nested_fieldset', ['name' => 'contactDetails', 'label' => $this->trans('client.heading.contact_details')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.firstName', 'label' => $this->trans('client.label.contact_details.first_name')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.lastName', 'label' => $this->trans('client.label.contact_details.last_name')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.phone', 'label' => $this->trans('client.label.contact_details.phone')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.secondaryPhone', 'label' => $this->trans('client.label.contact_details.secondary_phone')])); $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.email', 'label' => $this->trans('client.label.contact_details.email')])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }
/** * {@inheritdoc} */ public function buildForm(FormInterface $form) { $form->addChild($this->getElement('text_field', ['name' => 'nick', 'label' => $this->trans('review.label.nick')])); $form->addChild($this->getElement('hidden', ['name' => 'rating', 'label' => $this->trans('review.label.rating')])); $form->addChild($this->getElement('hidden', ['name' => 'ratingLevel', 'label' => $this->trans('review.label.rating')])); $form->addChild($this->getElement('hidden', ['name' => 'ratingRecommendation', 'label' => $this->trans('review.label.rating')])); $form->addChild($this->getElement('text_area', ['name' => 'review', 'label' => $this->trans('review.label.review'), 'rows' => 5, 'cols' => 10])); $form->addFilter($this->getFilter('no_code')); $form->addFilter($this->getFilter('trim')); $form->addFilter($this->getFilter('secure')); }