当前位置: 首页>>代码示例>>PHP>>正文


PHP FormInterface::addChild方法代码示例

本文整理汇总了PHP中WellCommerce\Component\Form\Elements\FormInterface::addChild方法的典型用法代码示例。如果您正苦于以下问题:PHP FormInterface::addChild方法的具体用法?PHP FormInterface::addChild怎么用?PHP FormInterface::addChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WellCommerce\Component\Form\Elements\FormInterface的用法示例。


在下文中一共展示了FormInterface::addChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $options = [];
     $processors = $this->getProcessors();
     foreach ($processors as $processor) {
         $options[$processor->getAlias()] = $processor->getName();
     }
     $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('form.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')]));
     $processorType = $requiredData->addChild($this->getElement('select', ['name' => 'processor', 'label' => $this->trans('payment_method.label.processor'), 'options' => $options, 'default' => current(array_keys($options))]));
     $requiredData->addChild($this->getElement('checkbox', ['name' => 'enabled', 'label' => $this->trans('common.label.enabled'), 'default' => 1]));
     $requiredData->addChild($this->getElement('text_field', ['name' => 'hierarchy', 'label' => $this->trans('common.label.hierarchy'), 'default' => 0]));
     $requiredData->addChild($this->getElement('select', ['name' => 'defaultOrderStatus', 'label' => $this->trans('common.label.default_order_status'), 'options' => $this->get('order_status.dataset.admin')->getResult('select'), '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'))]));
     $repository = $this->get('payment_method_configuration.repository');
     $configurationData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'configuration', 'property_path' => new PropertyPath('configuration'), 'label' => $this->trans('common.fieldset.general'), 'transformer' => $this->getRepositoryTransformer('payment_method_configuration', $repository)]));
     foreach ($processors as $processor) {
         $dependency = $this->getDependency('show', ['form' => $form, 'field' => $processorType, 'condition' => new Equals($processor->getAlias())]);
         $processor->addConfigurationFields($this, $configurationData, $dependency);
     }
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:pguso,项目名称:WellCommerce,代码行数:29,代码来源:PaymentMethodFormBuilder.php

示例2: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $countries = $this->get('country.repository')->all();
     $defaultCountry = $this->getShopStorage()->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.companyName', 'label' => $this->trans('client.label.address.company_name')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.vatId', 'label' => $this->trans('client.label.address.vat_id')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.line1', 'label' => $this->trans('client.label.address.line1')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.line2', 'label' => $this->trans('client.label.address.line2')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.postalCode', 'label' => $this->trans('client.label.address.postal_code')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.state', 'label' => $this->trans('client.label.address.state')]));
     $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]));
     $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.line1', 'label' => $this->trans('client.label.address.line1')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.line2', 'label' => $this->trans('client.label.address.line2')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.postalCode', 'label' => $this->trans('client.label.address.postal_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]));
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:WellCommerce,项目名称:ClientBundle,代码行数:31,代码来源:ClientAddressBookFormBuilder.php

示例3: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $countries = $this->get('country.repository')->all();
     $defaultCountry = $this->getShopStorage()->getCurrentShop()->getDefaultCountry();
     $billingAddress = $form->addChild($this->getElement('nested_fieldset', ['name' => 'billingAddress', 'label' => $this->trans('address.heading.billing_address')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.firstName', 'label' => $this->trans('common.label.first_name')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.lastName', 'label' => $this->trans('common.label.last_name')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.line1', 'label' => $this->trans('address.label.line1'), 'comment' => $this->trans('address.comment.line1')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.line2', 'label' => $this->trans('address.label.line2'), 'comment' => $this->trans('address.comment.line2')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.postalCode', 'label' => $this->trans('address.label.postal_code')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.state', 'label' => $this->trans('address.label.state')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.city', 'label' => $this->trans('address.label.city')]));
     $billingAddress->addChild($this->getElement('select', ['name' => 'billingAddress.country', 'label' => $this->trans('address.label.country'), 'options' => $countries, 'default' => $defaultCountry]));
     $shippingAddress = $form->addChild($this->getElement('nested_fieldset', ['name' => 'shippingAddress', 'label' => $this->trans('address.heading.shipping_address')]));
     $shippingAddress->addChild($this->getElement('checkbox', ['name' => 'shippingAddress.copyBillingAddress', 'label' => $this->trans('address.label.copy_address')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.firstName', 'label' => $this->trans('common.label.first_name')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.lastName', 'label' => $this->trans('common.label.last_name')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.line1', 'label' => $this->trans('address.label.line1'), 'comment' => $this->trans('address.comment.line1')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.line2', 'label' => $this->trans('address.label.line2'), 'comment' => $this->trans('address.comment.line2')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.postalCode', 'label' => $this->trans('address.label.postal_code')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.state', 'label' => $this->trans('address.label.state')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.city', 'label' => $this->trans('address.label.city')]));
     $shippingAddress->addChild($this->getElement('select', ['name' => 'shippingAddress.country', 'label' => $this->trans('address.label.country'), 'options' => $countries, 'default' => $defaultCountry]));
     $contactDetails = $form->addChild($this->getElement('nested_fieldset', ['name' => 'contactDetails', 'label' => $this->trans('address.heading.contact_details')]));
     $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.firstName', 'label' => $this->trans('common.label.first_name')]));
     $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.lastName', 'label' => $this->trans('common.label.last_name')]));
     $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.phone', 'label' => $this->trans('common.label.phone')]));
     $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.secondaryPhone', 'label' => $this->trans('common.label.secondary_phone')]));
     $contactDetails->addChild($this->getElement('text_field', ['name' => 'contactDetails.email', 'label' => $this->trans('common.label.email')]));
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:wellcommerce,项目名称:wellcommerce,代码行数:36,代码来源:OrderAddressFormBuilder.php

示例4: buildForm

 /**
  * {@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'));
 }
开发者ID:wellcommerce,项目名称:wellcommerce,代码行数:33,代码来源:PaymentMethodFormBuilder.php

示例5: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $form->addChild($this->getElement('text_field', ['name' => '_username', 'label' => $this->trans('client.label.username')]));
     $form->addChild($this->getElement('password', ['name' => '_password', 'label' => $this->trans('client.label.password')]));
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:Newman101,项目名称:WellCommerce,代码行数:11,代码来源:ClientLoginFormBuilder.php

示例6: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $form->addChild($this->getElement('text_field', ['name' => 'username', 'label' => $this->trans('user.label.username'), 'rules' => [$this->getRule('required')]]));
     $form->addChild($this->getElement('submit', ['name' => 'reset_password', 'label' => $this->trans('user.button.reset_password')]));
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:Newman101,项目名称:WellCommerce,代码行数:11,代码来源:UserResetPasswordFormBuilder.php

示例7: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $form->addChild($this->getElement('text_field', ['name' => 'email', 'label' => $this->trans('contact_ticket.label.email')]));
     $form->addChild($this->getElement('text_field', ['name' => 'subject', 'label' => $this->trans('contact_ticket.label.subject')]));
     $form->addChild($this->getElement('text_area', ['name' => 'content', 'label' => $this->trans('contact_ticket.label.content'), 'rows' => 5, 'cols' => 10]));
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:WellCommerce,项目名称:ContactBundle,代码行数:12,代码来源:ContactFormBuilder.php

示例8: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $orderStatuses = $this->get('order_status.dataset.admin')->getResult('select');
     $form->addChild($this->getElement('select', ['name' => 'orderStatus', 'label' => $this->trans('order_status_history.label.order_status'), 'options' => $orderStatuses, 'transformer' => $this->getRepositoryTransformer('entity', $this->get('order_status.repository'))]));
     $form->addChild($this->getElement('text_area', ['name' => 'comment', 'rows' => 10, 'label' => $this->trans('order_status_history.label.comment')]));
     $form->addChild($this->getElement('checkbox', ['name' => 'notify', 'label' => $this->trans('order_status_history.label.nofity'), 'default' => 1]));
     $form->addChild($this->getElement('submit', ['name' => 'add_order_status_history', 'label' => $this->trans('order_status_history.button.change')]));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:wellcommerce,项目名称:wellcommerce,代码行数:13,代码来源:OrderStatusHistoryFormBuilder.php

示例9: buildForm

 public function buildForm(FormInterface $form)
 {
     $shippingMethod = $form->addChild($this->getElement('radio_group', ['name' => 'shippingMethod', 'label' => $this->trans('cart.label.shipping_method'), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('shipping_method.repository'))]));
     $this->addShippingOptions($shippingMethod);
     $paymentMethod = $form->addChild($this->getElement('radio_group', ['name' => 'paymentMethod', 'label' => $this->trans('cart.label.payment_method'), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('payment_method.repository'))]));
     $this->addPaymentOptions($paymentMethod);
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:wellcommerce,项目名称:wellcommerce,代码行数:10,代码来源:OrderCartFormBuilder.php

示例10: buildForm

 /**
  * {@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');
     $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('fieldset.language.label'), '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('common.comment.enabled')]));
     $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('fieldset.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'))]));
     $metaData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'meta_data', 'label' => $this->trans('common.fieldset.meta')]));
     $languageData = $metaData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('fieldset.translations.label'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('product.repository'))]));
     $languageData->addChild($this->getElement('text_field', ['name' => 'meta.title', 'label' => $this->trans('common.label.meta.title')]));
     $languageData->addChild($this->getElement('text_field', ['name' => 'meta.keywords', 'label' => $this->trans('common.label.meta.keywords')]));
     $languageData->addChild($this->getElement('text_area', ['name' => 'meta.description', 'label' => $this->trans('common.label.meta.description')]));
     $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.tax.add_item_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.tax.add_item_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('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('common.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'))]));
     $attributesData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'attributes_data', 'label' => $this->trans('product.form.fieldset.attributes')]));
     $attributesData->addChild($this->getElement('product_variants_editor', ['name' => 'attributes', 'label' => $this->trans('product.label.attributes'), 'suffixes' => ['+', '-', '%'], 'price_field' => $sellPriceAmount, 'vat_field' => $sellPriceTax, 'vat_values' => $vatValues, 'category_field' => $categoriesField, 'availability_field' => $availabilityField, 'availability' => $availabilityField->getOption('options'), 'transformer' => $this->getRepositoryTransformer('product_attribute_collection', $this->get('product_attribute.repository'))]));
     $shopsData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'shops_data', 'label' => $this->trans('product.common.fieldset.shops')]));
     $shopsData->addChild($this->getElement('multi_select', ['name' => 'shops', 'label' => $this->trans('product.common.fieldset.shops'), 'options' => $this->get('shop.dataset.admin')->getResult('select'), 'transformer' => $this->getRepositoryTransformer('collection', $this->get('shop.repository'))]));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:Sywooch,项目名称:WellCommerce,代码行数:58,代码来源:ProductFormBuilder.php

示例11: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $form->addChild($this->getElement('text_field', ['name' => '_username', 'label' => $this->trans('user.label.username'), 'rules' => [$this->getRule('required')]]));
     $form->addChild($this->getElement('password', ['name' => '_password', 'label' => $this->trans('user.label.password'), 'rules' => [$this->getRule('required')]]));
     $form->addChild($this->getElement('submit', ['name' => 'log_in', 'label' => $this->trans('user.button.log_in')]));
     $resetUrl = $this->getRouterHelper()->generateUrl('admin.user.reset_password');
     $form->addChild($this->getElement('static_text', ['text' => '<a href="' . $resetUrl . '">' . $this->trans('user.button.reset_password') . '</a>']));
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:Newman101,项目名称:WellCommerce,代码行数:14,代码来源:UserLoginFormBuilder.php

示例12: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $groupData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'group_data', 'class' => 'group-data', 'label' => $this->trans('attribute_group.label.group')]));
     $languageData = $groupData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('admin.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('attribute_group.repository'))]));
     $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name')]));
     $attributeData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'attribute_data', 'class' => 'attribute-data', 'label' => $this->trans('attribute_group.label.attributes')]));
     $attributeData->addChild($this->getElement('attribute_editor', ['name' => 'attributes', 'label' => $this->trans('attribute_group.label.attributes'), 'set' => $this->getParam('id'), 'delete_attribute_route' => 'admin.attribute.delete', 'rename_attribute_route' => 'admin.attribute.edit', 'rename_attribute_value_route' => 'admin.attribute_value.edit', 'attributes' => $this->get('attribute.repository')->findAll(), 'transformer' => $this->getRepositoryTransformer('attribute_collection', $this->get('attribute.repository'))]));
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:pguso,项目名称:WellCommerce,代码行数:14,代码来源:AttributeGroupFormBuilder.php

示例13: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $cart = $this->cartContext->getCurrentCart();
     $shippingMethod = $form->addChild($this->getElement('radio_group', ['name' => 'shippingMethodCost', 'label' => $this->trans('cart.shipping_method.label'), 'options' => [], 'transformer' => $this->getRepositoryTransformer('entity', $this->get('shipping_method_cost.repository'))]));
     $this->addShippingOptions($shippingMethod, $cart);
     $paymentMethod = $form->addChild($this->getElement('radio_group', ['name' => 'paymentMethod', 'label' => $this->trans('cart.payment_method.label'), 'options' => [], 'transformer' => $this->getRepositoryTransformer('entity', $this->get('payment_method.repository'))]));
     $this->addPaymentOptions($paymentMethod, $cart);
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:Newman101,项目名称:WellCommerce,代码行数:14,代码来源:CartFormBuilder.php

示例14: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $groupData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'main_data', 'label' => $this->trans('attribute_group.label.group')]));
     $languageData = $groupData->addChild($this->getElement('language_fieldset', ['name' => 'translations', 'label' => $this->trans('common.fieldset.translations'), 'transformer' => $this->getRepositoryTransformer('translation', $this->get('attribute_group.repository'))]));
     $languageData->addChild($this->getElement('text_field', ['name' => 'name', 'label' => $this->trans('common.label.name'), 'rules' => [$this->getRule('required')]]));
     $attributesData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'attributes_data', 'label' => $this->trans('attribute_group.fieldset.attributes')]));
     $attributesData->addChild($this->getElement('multi_select', ['name' => 'attributes', 'label' => $this->trans('attribute_group.label.attributes'), 'options' => $this->get('attribute.dataset.admin')->getResult('select'), 'transformer' => $this->getRepositoryTransformer('collection', $this->get('attribute.repository'))]));
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:wellcommerce,项目名称:wellcommerce,代码行数:14,代码来源:AttributeGroupFormBuilder.php

示例15: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $order = $this->getOrderProvider()->getCurrentOrder();
     $countries = $this->get('country.repository')->all();
     $requiredData = $form->addChild($this->getElement('nested_fieldset', ['name' => 'required_data', 'label' => $this->trans('order.form.fieldset.products')]));
     $requiredData->addChild($this->getElement('order_editor', ['name' => 'products', 'label' => $this->trans('order.heading.products'), 'repeat_min' => 1, 'repeat_max' => ElementInterface::INFINITE, 'load_products_route' => 'admin.product.grid', 'on_change' => 'OnProductListChange', 'on_before_change' => 'OnProductListBeforeChange', 'transformer' => $this->getRepositoryTransformer('order_product_collection', $this->get('order_product.repository'))]));
     $orderDetails = $form->addChild($this->getElement('columns', ['name' => 'orderMethodsDetails', 'label' => $this->trans('order.heading.order_methods_details')]));
     $paymentShippingData = $orderDetails->addChild($this->getElement('nested_fieldset', ['name' => 'methods', 'label' => $this->trans('client.heading.billing_address')]));
     $shippingMethod = $paymentShippingData->addChild($this->getElement('select', ['name' => 'shippingMethod', 'label' => $this->trans('order.label.shipping_method'), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('shipping_method.repository'))]));
     $this->addShippingOptions($shippingMethod);
     $paymentMethod = $paymentShippingData->addChild($this->getElement('select', ['name' => 'paymentMethod', 'label' => $this->trans('order.label.payment_method'), 'transformer' => $this->getRepositoryTransformer('entity', $this->get('payment_method.repository'))]));
     $this->addPaymentOptions($paymentMethod);
     $order->getModifiers()->map(function (OrderModifierInterface $modifier) use($paymentShippingData) {
         $paymentShippingData->addChild($this->getElement('constant', ['name' => 'summary.' . $modifier->getName(), 'label' => $modifier->getDescription()]))->setValue($modifier->getGrossAmount());
     });
     $summaryData = $orderDetails->addChild($this->getElement('nested_fieldset', ['name' => 'summary', 'label' => $this->trans('order.heading.order_total')]));
     $summaryData->addChild($this->getElement('constant', ['name' => 'productTotal.netPrice', 'label' => $this->trans('order.label.product_total.net_price')]));
     $summaryData->addChild($this->getElement('constant', ['name' => 'productTotal.taxAmount', 'label' => $this->trans('order.label.product_total.tax_amount')]));
     $summaryData->addChild($this->getElement('constant', ['name' => 'productTotal.grossPrice', 'label' => $this->trans('order.label.product_total.gross_price')]));
     $summaryData->addChild($this->getElement('constant', ['name' => 'summary.netAmount', 'label' => $this->trans('order.label.summary.net_amount')]));
     $summaryData->addChild($this->getElement('constant', ['name' => 'summary.taxAmount', 'label' => $this->trans('order.label.summary.tax_amount')]));
     $summaryData->addChild($this->getElement('constant', ['name' => 'summary.grossAmount', 'label' => $this->trans('order.label.summary.gross_amount')]));
     $contactDetails = $form->addChild($this->getElement('nested_fieldset', ['name' => 'contactDetails', 'label' => $this->trans('order.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')]));
     $addresses = $form->addChild($this->getElement('columns', ['name' => 'addresses', 'label' => $this->trans('order.heading.address')]));
     $billingAddress = $addresses->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.line1', 'label' => $this->trans('client.label.address.line1')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.line2', 'label' => $this->trans('client.label.address.line2')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.postalCode', 'label' => $this->trans('client.label.address.postal_code')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.state', 'label' => $this->trans('client.label.address.state')]));
     $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]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.vatId', 'label' => $this->trans('client.label.address.vat_id')]));
     $billingAddress->addChild($this->getElement('text_field', ['name' => 'billingAddress.companyName', 'label' => $this->trans('client.label.address.company_name')]));
     $shippingAddress = $addresses->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.line1', 'label' => $this->trans('client.label.address.line1')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.line2', 'label' => $this->trans('client.label.address.line2')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.postalCode', 'label' => $this->trans('client.label.address.postal_code')]));
     $shippingAddress->addChild($this->getElement('text_field', ['name' => 'shippingAddress.state', 'label' => $this->trans('client.label.address.state')]));
     $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]));
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
开发者ID:WellCommerce,项目名称:OrderBundle,代码行数:56,代码来源:OrderFormBuilder.php


注:本文中的WellCommerce\Component\Form\Elements\FormInterface::addChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。