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


PHP Form\FormMapper类代码示例

本文整理汇总了PHP中Sonata\AdminBundle\Form\FormMapper的典型用法代码示例。如果您正苦于以下问题:PHP FormMapper类的具体用法?PHP FormMapper怎么用?PHP FormMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     $p = $this->getSubject();
     global $kernel;
     if ('AppCache' == get_class($kernel)) {
         $kernel = $kernel->getKernel();
     }
     $em = $kernel->getContainer()->get('doctrine.orm.entity_manager');
     $repo_product = $em->getRepository('AppBundle:ProductCategoryList');
     $product_cats = $repo_product->findBy(array('product' => $p->getId()));
     $cats_array = array();
     foreach ($product_cats as $p) {
         $cats_array[] = $p->getCategory()->getId();
     }
     $repo = $em->getRepository('AppBundle:ProductCategory');
     $product = $repo->findById($cats_array);
     $sumarr = array();
     if (!empty($product)) {
         foreach ($product as $p) {
             $sumarr[] = $p;
         }
     }
     $sumarr['property'] = 'title';
     $formMapper->add('title', null, array('label' => 'Title'))->add('price', null, array('label' => 'Cost', 'required' => true))->add('inStock', null, array('label' => 'In stock', 'required' => true))->add('discount', 'entity', array('class' => 'AppBundle\\Entity\\ProductDiscountGroup', 'property' => 'title', 'required' => false, 'label' => 'Discount group'))->add('images', 'sonata_type_collection', array('cascade_validation' => false, 'type_options' => array('delete' => true)), array('edit' => 'inline', 'inline' => 'table'))->add('categories', 'entity', array('class' => 'AppBundle\\Entity\\ProductCategory', 'property' => 'title', 'multiple' => true, 'label' => 'Categories', 'required' => TRUE, 'expanded' => true, 'data' => $sumarr));
 }
开发者ID:HOMOTRISTIS,项目名称:jct,代码行数:25,代码来源:ProductAdmin.php

示例2: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->with('form.group_general', array('translation_domain' => 'CmfRoutingBundle'))->add('parent', Sf2CompatUtil::getFormTypeName('doctrine_phpcr_odm_tree'), array('choice_list' => array(), 'select_root_node' => true, 'root_node' => $this->routeRoot))->add('name', Sf2CompatUtil::getFormTypeName('text'))->end();
     if (null === $this->getParentFieldDescription()) {
         $formMapper->with('form.group_general', array('translation_domain' => 'CmfRoutingBundle'))->add('content', Sf2CompatUtil::getFormTypeName('doctrine_phpcr_odm_tree'), array('choice_list' => array(), 'required' => false, 'root_node' => $this->contentRoot))->end()->with('form.group_advanced', array('translation_domain' => 'CmfRoutingBundle'))->add('variablePattern', Sf2CompatUtil::getFormTypeName('text'), array('required' => false), array('help' => 'form.help_variable_pattern'))->add('defaults', Sf2CompatUtil::getFormTypeName('sonata_type_immutable_array'), array('keys' => $this->configureFieldsForDefaults($this->getSubject()->getDefaults())))->add('options', Sf2CompatUtil::getFormTypeName('sonata_type_immutable_array'), array('keys' => $this->configureFieldsForOptions($this->getSubject()->getOptions())), array('help' => 'form.help_options'))->end()->end();
     }
 }
开发者ID:hacfi,项目名称:RoutingBundle,代码行数:7,代码来源:RouteAdmin.php

示例3: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->add('bg', 'text', array("label" => "Fichier", 'required' => false));
     $formMapper->add('name', 'text', array("label" => "Nom de Fichier"));
     $formMapper->add('pdf', 'text', array("label" => "Fichier Pdf"));
     $formMapper->add('parameters', 'sonata_type_collection', array('by_reference' => false), array('edit' => 'inline', 'inline' => 'table', 'sortable' => 'position'));
 }
开发者ID:saliih,项目名称:yasmine-print,代码行数:7,代码来源:TplprodAdmin.php

示例4: configureFormFields

 /**
  * {@inheritdoc}
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->tab('form.menunode.tab.General')->with('form.menunode.general')->end()->with('form.menunode.parameters', ['class' => 'col-md-8'])->end()->with('form.menunode.position', ['class' => 'col-md-4'])->end()->end()->tab('form.menunode.tab.Rules')->with('form.menunode.rules')->end()->end()->tab('form.menunode.tab.Customization')->with('form.menunode.customization')->end()->end();
     $formMapper->tab('form.menunode.tab.General')->with('form.menunode.general')->add('name', 'text', ['label' => $this->trans('form.menunode.name', [], 'admin'), 'help' => $this->trans('help.menunode.name', [], 'admin')])->add('label', 'text', ['label' => $this->trans('form.menunode.label', [], 'admin'), 'help' => $this->trans('help.menunode.label', [], 'admin')])->end()->with('form.menunode.parameters')->add('linkType', 'sonata_type_choice_field_mask', ['choices' => ['uri' => $this->trans('form.menunode.uri', [], 'admin'), 'route' => $this->trans('form.menunode.route', [], 'admin')], 'map' => ['route' => ['route', 'routeParameters'], 'uri' => ['uri']], 'empty_value' => 'form.linkType.empty_value', 'required' => false])->add('route', 'text', ['required' => false])->add('uri', 'text', ['required' => false])->add('routeParameters', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->end()->with('form.menunode.position')->add('parent', null, ['class' => 'ZapoyokMenuBundle:MenuNode', 'property' => 'nameWithLevel', 'empty_value' => 'Choose a parent', 'empty_data' => null, 'query_builder' => $this->menuNodeManager->getNodesHierarchyQueryBuilder($this->getParent()->getSubject())])->add('reorder', 'zapoyok_menu_reorder', ['mapped' => false, 'current_node' => $this->getSubject()])->end()->end();
     $formMapper->tab('form.menunode.tab.Customization')->with('form.menunode.customization')->add('attributes', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->add('childrenAttributes', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->add('linkAttributes', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->add('labelAttributes', 'zapoyok_extraform_key_value', ['value_type' => 'text'])->end()->end();
     //parent::configureFormFields($formMapper);
 }
开发者ID:zapoyok,项目名称:menu-bundle,代码行数:10,代码来源:MenuNodeAdmin.php

示例5: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     $subject = $this->getSubject();
     $currentCategoryId = $subject->getId();
     $locale = $this->getConfigurationPool()->getContainer()->get('request_stack')->getCurrentRequest()->getLocale();
     $formMapper->add('translations', 'a2lix_translations');
 }
开发者ID:Nexotap,项目名称:Ivory,代码行数:7,代码来源:PaymentTermAdmin.php

示例6: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     $container = $this->getConfigurationPool()->getContainer();
     $roles = $container->getParameter('security.role_hierarchy.roles');
     $rolesChoices = self::flattenRoles($roles);
     $formMapper->add('username', 'text', array('label' => 'Username'))->add('password', 'text', array('label' => 'Mot de passe'))->add('firstname', 'text', array('label' => 'Firs Name'))->add('lastname', 'text', array('label' => 'Last Name'))->add('birthdate', 'date', array('widget' => 'single_text', 'required' => false, 'attr' => array('class' => 'datepicker')))->add('email', 'text', array('label' => 'Email'))->add('roles', 'choice', array('choices' => $rolesChoices, 'multiple' => true))->add('enabled', 'checkbox', array('label' => 'Enabled', 'required' => true));
 }
开发者ID:bricegates,项目名称:cba_trainning.com,代码行数:7,代码来源:UserAdmin.php

示例7: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     /** @var $entity_devises \Application\Sonata\DevisesBundle\Entity\Devises */
     $entity_devises = $this->getEntityDevises();
     list($create_years, $create_months) = explode('-', $this->getCurrentYearMonth());
     $this->_current_devises = $this->getCurrentDevises($create_years . '-' . $create_months);
     $months = $entity_devises ? $entity_devises->getDate()->format('n') : $create_months;
     $years = $entity_devises ? $entity_devises->getDate()->format('Y') : $create_years;
     /* @var $securityContext SecurityContext */
     $securityContext = \AppKernel::getStaticContainer()->get('security.context');
     $disables = array();
     if (!$securityContext->isGranted('ROLE_EDIT_DEVISES_WRITE') || !($months == $create_months && $years == $create_years)) {
         $disables = array('disabled' => true);
     }
     $formMapper->with($this->_bundle_name . '.form.Devises')->add('date_change', 'choice', array('label' => $this->_bundle_name . '.form.DateChange', 'choices' => $this->getDateChange(), 'data' => $entity_devises ? $this->generateObjectUrl('edit', $entity_devises) : $this->generateUrl('create'), 'attr' => array('style' => 'width:auto')));
     $devisesList = LoadListDevisesData::getStaticList();
     unset($devisesList[ListDevises::Device]);
     ksort($devisesList);
     foreach ($devisesList as $field => $labelData) {
         /** @var $entity  \Application\Sonata\ClientBundle\Entity\ListDevises */
         $formMapper->add('money' . $field, 'money', array('decorator' => function ($pattern) use($field) {
             return $pattern . ' ' . $field;
         }, 'label' => '1 euro', 'precision' => 5, 'divisor' => 1, 'currency' => false) + $disables);
     }
 }
开发者ID:defan-marunchak,项目名称:eurotax,代码行数:25,代码来源:DevisesAdmin.php

示例8: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     $line = $this->getSubject();
     $fileFieldOptions = array('required' => false, 'label' => 'Картинка');
     if ($line && ($webPath = $line->getWebPath())) {
         $container = $this->getConfigurationPool()->getContainer();
         $fullPath = $container->get('request')->getBasePath() . '/' . $webPath;
         $fileFieldOptions['help'] = '<img src="' . $fullPath . '" class="admin-preview" />';
     }
     $formMapper->add('title', 'text', array('label' => 'Название'))->add('file', 'file', $fileFieldOptions)->add('preview', 'textarea', array('attr' => array('cols' => '30', 'rows' => '5'), 'label' => 'Превью текста'))->add('button_title', 'text', array('label' => 'Название кнопки'))->add('description', 'textarea', array('attr' => array('cols' => '30', 'rows' => '10'), 'label' => 'Текст'))->add('weight', 'integer', array('label' => 'Вес'))->add('active', 'checkbox', array('label' => 'Активность'));
     //        $formBuilder = $formMapper->getFormBuilder();
     //        $formBuilder->add('description', 'sonata_formatter_type', array(
     //            'event_dispatcher' => $formBuilder->getEventDispatcher(),
     //            'format_field'   => 'descriptionFormatter',
     //            'source_field'   => 'rawDescription',
     //            'source_field_options'      => array(
     //                'attr' => array('class' => 'span10', 'rows' => 20)
     //            ),
     //            'listener'       => true,
     //            'target_field'   => 'description'
     //        ));
     //        $formBuilder->add('rawDescription', 'sonata_formatter_type') // source content
     //                    ->add('descriptionFormatter', 'sonata_formatter_type', array(
     //                        'source_field' => 'rawDescription',
     //                        'target_field' => 'description'
     //        ));
 }
开发者ID:belozyorovany,项目名称:advice,代码行数:27,代码来源:CaseAreaAdmin.php

示例9: buildEditForm

 /**
  * {@inheritdoc}
  */
 public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
 {
     $contextChoices = $this->getContextChoices();
     $formatChoices = $this->getFormatChoices($block->getSetting('mediaId'));
     $translator = $this->container->get('translator');
     $formMapper->add('settings', 'sonata_type_immutable_array', array('keys' => array(array('title', 'text', array('required' => false)), array('content', 'textarea', array('required' => false)), array('orientation', 'choice', array('choices' => array('left' => $translator->trans('feature_left_choice', array(), 'SonataMediaBundle'), 'right' => $translator->trans('feature_right_choice', array(), 'SonataMediaBundle')))), array('context', 'choice', array('required' => true, 'choices' => $contextChoices)), array('format', 'choice', array('required' => count($formatChoices) > 0, 'choices' => $formatChoices)), array($this->getMediaBuilder($formMapper), null, array()))));
 }
开发者ID:novatex,项目名称:SonataMediaBundle,代码行数:10,代码来源:FeatureMediaBlockService.php

示例10: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->add('name', 'text', array('label' => 'Workflow Title'))->add('description', 'sizannia_editor_type', array('label' => 'Workflow description'))->add('isEnable', 'checkbox', array('required' => false, 'label' => 'Enable'))->add('stateWorkflow', 'sonata_type_collection', array('cascade_validation' => true), array('sortable' => 'level', 'edit' => 'inline', 'inline' => 'table', 'admin_code' => 'sonata.admin.stateworkflow'));
     //->add('_action', 'actions', array('actions' => array('show' => array(),'edit' => array(),)))
     //->add('project')
     //, array('btn_list' => true, 'btn_delete' => false)
 }
开发者ID:serialken,项目名称:BugTracker,代码行数:7,代码来源:WorkflowAdmin.php

示例11: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     // Fields to be shown on create/edit forms
     $formMapper->add('title', 'text', ['label' => 'Title'])->add('venue', 'sonata_type_model_autocomplete', ['property' => 'name', 'attr' => ['style' => 'width:300px'], 'to_string_callback' => function ($entity, $property) {
         return $entity->getName();
     }])->add('eventStart', 'sonata_type_datetime_picker')->add('eventEnd', 'sonata_type_datetime_picker')->add('minAge', 'choice', ['choices' => ['all_ages' => 'All Ages', '13' => '13', '16' => '16', '18' => '18', '21' => '21'], 'data' => 'all_ages'])->add('maxCapacity');
 }
开发者ID:0xMatt,项目名称:SymNSonata,代码行数:7,代码来源:EventAdmin.php

示例12: configureFormFields

 /**
  * {@inheritdoc}
  */
 public function configureFormFields(FormMapper $formMapper)
 {
     if (!$this->isChild()) {
         $formMapper->with($this->trans('order.form.group_main_label', array(), 'SonataOrderBundle'))->add('customer', 'sonata_type_model_list')->end();
     }
     $formMapper->with($this->trans('order.form.group_main_label', array(), 'SonataOrderBundle'))->add('currency', 'sonata_currency')->add('locale', 'locale')->add('status', 'sonata_order_status', array('translation_domain' => 'SonataOrderBundle'))->add('paymentStatus', 'sonata_payment_transaction_status', array('translation_domain' => 'SonataPaymentBundle'))->add('deliveryStatus', 'sonata_product_delivery_status', array('translation_domain' => 'SonataDeliveryBundle'))->add('validatedAt')->end()->with($this->trans('order.form.group_billing_label', array(), 'SonataOrderBundle'), array('collapsed' => true))->add('billingName')->add('billingAddress1')->add('billingAddress2')->add('billingAddress3')->add('billingCity')->add('billingPostcode')->add('billingCountryCode', 'country')->add('billingFax')->add('billingEmail')->add('billingMobile')->end()->with($this->trans('order.form.group_shipping_label', array(), 'SonataOrderBundle'), array('collapsed' => true))->add('shippingName')->add('shippingAddress1')->add('shippingAddress2')->add('shippingAddress3')->add('shippingCity')->add('shippingPostcode')->add('shippingCountryCode', 'country')->add('shippingFax')->add('shippingEmail')->add('shippingMobile')->end();
 }
开发者ID:Dicoding,项目名称:ecommerce,代码行数:10,代码来源:OrderAdmin.php

示例13: configureFormFields

 protected function configureFormFields(FormMapper $formMapper)
 {
     $subject = $this->getSubject();
     $em = $this->getModelManager()->getEntityManager($subject);
     $transformer = new DocumentToStringTransformer($em, $subject);
     $formMapper->add($formMapper->create('DocumentID', 'text', array('label' => 'ID документа', 'required' => true, 'by_reference' => false))->addModelTransformer($transformer))->add('url', null, array('label' => 'Короткий адрес', 'required' => true))->add('title', null, array('label' => 'Название', 'required' => true))->add('body', 'textarea', array('label' => 'Содержимое', 'required' => true, 'attr' => array('class' => 'ckeditorfull')))->add('created', null, array('label' => 'Дата создания', 'required' => false))->add('enabled', null, array('label' => 'Активен', 'required' => false));
 }
开发者ID:Evrika,项目名称:Vidal,代码行数:7,代码来源:PharmPortfolioAdmin.php

示例14: configureFormFields

 /**
  * {@inheritdoc}
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->with('General')->add('username', null, array('attr' => array('autofocus' => 'autofocus')))->add('email', null, array('required' => true))->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->end()->with('Groups')->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->with('Profile')->add('firstname', null, array('required' => false))->add('lastname', null, array('required' => false))->add('gender', 'sonata_user_gender', array('required' => true, 'translation_domain' => $this->getTranslationDomain()))->end();
     //        if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
     //            $formMapper
     //                ->with('Management')
     //                    ->add('realRoles', 'sonata_security_roles', array(
     //                        'label'    => 'form.label_roles',
     //                        'expanded' => true,
     //                        'multiple' => true,
     //                        'required' => false
     //                    ))
     //                    ->add('locked', null, array('required' => false))
     //                    ->add('expired', null, array('required' => false))
     //                    ->add('enabled', null, array('required' => false))
     //                    ->add('credentialsExpired', null, array('required' => true, 'data' => true))
     //                ->end()
     //            ;
     //        }
     //
     //        $formMapper
     //            ->with('Security')
     //                ->add('token', null, array('required' => false))
     //                ->add('twoStepVerificationCode', null, array('required' => false))
     //            ->end()
     //        ;
 }
开发者ID:princedominh,项目名称:tkb,代码行数:30,代码来源:UserAdmin.php

示例15: configureFormFields

 /**
  * {@inheritdoc}
  */
 public function configureFormFields(FormMapper $formMapper)
 {
     if (!$this->isChild()) {
         $formMapper->add('product', 'sonata_type_model_list', array(), array('admin_code' => 'sonata.product.admin.product'));
     }
     $formMapper->add('category')->add('main')->add('enabled');
 }
开发者ID:lzdv,项目名称:ecommerce,代码行数:10,代码来源:ProductCategoryAdmin.php


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