예제 #1
1
 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));
 }
예제 #2
1
 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();
     }
 }
예제 #3
1
 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'));
 }
예제 #4
1
 /**
  * {@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);
 }
예제 #5
0
 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');
 }
예제 #6
0
 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));
 }
예제 #7
0
 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);
     }
 }
예제 #8
0
 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'
     //        ));
 }
 /**
  * {@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()))));
 }
예제 #10
0
 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)
 }
예제 #11
0
 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');
 }
예제 #12
0
 /**
  * {@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();
 }
예제 #13
0
 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));
 }
예제 #14
0
 /**
  * {@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()
     //        ;
 }
예제 #15
0
 /**
  * {@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');
 }
예제 #16
0
 /**
  * @param \Sonata\AdminBundle\Form\FormMapper $formMapper
  */
 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('enabled')->add('code', 'sonata_delivery_choice')->add('perItem')->add('countryCode', 'country')->add('zone');
 }
예제 #17
0
 /**
  * {@inheritdoc}
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->with('General')->add('username')->add('email')->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();
     if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
         $formMapper->with('Management')->add('realRoles', 'lyssal_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' => false))->end();
     }
 }
예제 #18
0
 protected function configureFormFields(FormMapper $formMapper)
 {
     // Getting the container parameters set in the config file that exist
     $skeletonSettings = $this->getConfigurationPool()->getContainer()->getParameter('skeleton_settings');
     // Setting up the available page types and preffered choice
     $pagetypeChoices = $skeletonSettings['pagetypes'];
     reset($pagetypeChoices);
     $prefPagetypeChoice = key($pagetypeChoices);
     // Setting up the available media sizes and preffered choice
     $introMediaSizeChoices = $skeletonSettings['mediasizes'];
     reset($introMediaSizeChoices);
     $prefIntroMediaSizeChoice = key($introMediaSizeChoices);
     // Getting the user from container services that exist
     $loggedUser = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser();
     // Using sonata admin to generate the edit page form and its fields
     $formMapper->tab('Skeleton Page Essential Details')->with('Skeleton Page Essential Details', array('collapsed' => true))->add('title', null, array('attr' => array('class' => 'pageTitleField'), 'label' => 'Skeleton Page Title', 'required' => true))->add('publishState', 'choice', array('choices' => array('0' => 'Unpublished', '1' => 'Published', '2' => 'Preview'), 'preferred_choices' => array('2'), 'label' => 'Publish Status', 'required' => true))->add('date', 'date', array('widget' => 'single_text', 'format' => 'dd-MM-yyyy', 'attr' => array('class' => 'datepicker'), 'label' => 'Publish Date', 'required' => true))->add('author', 'entity', array('class' => 'Application\\Sonata\\UserBundle\\Entity\\User', 'property' => 'username', 'expanded' => false, 'multiple' => false, 'label' => 'Author', 'data' => $loggedUser->getUsername(), 'required' => true))->add('alias', null, array('attr' => array('class' => 'pageAliasField'), 'label' => 'Skeleton Page Alias', 'required' => false))->add('pagetype', 'choice', array('choices' => $pagetypeChoices, 'preferred_choices' => array($prefPagetypeChoice), 'label' => 'Skeleton Page Type', 'required' => true))->add('showPageTitle', 'choice', array('choices' => array('0' => 'Hide Title', '1' => 'Show Title'), 'preferred_choices' => array('1'), 'label' => 'Title Display', 'required' => true))->add('pageclass', null, array('label' => 'Skeleton Page CSS Class', 'required' => false))->setHelps(array('title' => 'Set the title of the Skeleton Page', 'publishState' => 'Set the publish status of the Skeleton Page', 'date' => 'Set the publishing date of the Skeleton Page', 'author' => 'The Author of the skeleton page', 'alias' => 'Set the URL alias of the Skeleton Page', 'pagetype' => 'Select the type of the Skeleton Page (Skeleton Page template)', 'pageclass' => 'Set the CSS class that wraps Skeleton Page'))->end()->end()->tab('Categories & Tags')->with('Categories & Tags', array('collapsed' => true))->add('categories', 'entity', array('class' => 'BardisCMS\\CategoryBundle\\Entity\\Category', 'property' => 'title', 'expanded' => true, 'multiple' => true, 'label' => 'Associated Categories', 'required' => false))->add('tags', 'entity', array('class' => 'BardisCMS\\TagBundle\\Entity\\Tag', 'property' => 'title', 'expanded' => true, 'multiple' => true, 'label' => 'Associated Tags', 'required' => false))->setHelps(array('tags' => 'Select the associated tags', 'categories' => 'Select the associated categories'))->end()->end()->tab('Skeleton Listing Page Intro')->with('Skeleton Listing Page Intro', array('collapsed' => true))->add('introtext', 'textarea', array('attr' => array('class' => 'tinymce', 'data-theme' => 'advanced'), 'label' => 'Intro Text/HTML', 'required' => false))->add('introimage', 'sonata_media_type', array('provider' => 'sonata.media.provider.image', 'context' => 'intro', 'attr' => array('class' => 'imagefield'), 'label' => 'Intro Image', 'required' => false))->add('introvideo', 'sonata_media_type', array('provider' => 'sonata.media.provider.vimeo', 'context' => 'intro', 'attr' => array('class' => 'videofield'), 'label' => 'Vimeo Video Id', 'required' => false))->add('pageOrder', null, array('label' => 'Intro Item Ordering in Homepage', 'required' => true))->add('introclass', null, array('label' => 'Intro Item CSS Class', 'required' => false))->setHelps(array('introtext' => 'Set the Text/HTML content to display for intro listing items', 'introimage' => 'Set the Image content to display for intro listing items', 'introvideo' => 'Set the video content to display for intro listing items', 'pageOrder' => 'Set the order of this Skeleton page intro for the homepage', 'introclass' => 'Set the CSS class that wraps content to display for intro listing items'))->end()->end()->tab('Skeleton Page Metatags Manual Override')->with('Skeleton Page Metatags Manual Override', array('collapsed' => true))->add('keywords', null, array('label' => 'Meta Keywords', 'required' => false))->add('description', null, array('label' => 'Meta Description', 'required' => false))->setHelps(array('keywords' => 'Set the keyword metadata of the page of leave empty to autogenerate', 'description' => 'Set the description metadata of the page of leave empty to autogenerate'))->end()->end();
     // Check if it is a new entry. If it is hide the content block management
     if (!is_null($this->getSubject()->getId())) {
         // Setting up the available content block holders for each pagetype
         switch ($this->subject->getPagetype()) {
             case 'skeleton_article':
                 $formMapper->tab('Skeleton Page Contents')->with('Skeleton Page Contents', array('collapsed' => true))->add('bannercontentblocks', 'contentblockcollection', array('attr' => array('class' => 'bannercontentblocks'), 'label' => 'Top Contents'))->add('maincontentblocks', 'contentblockcollection', array('attr' => array('class' => 'maincontentblocks'), 'label' => 'Main Contents'))->add('modalcontentblocks', 'contentblockcollection', array('attr' => array('class' => 'modalcontentblocks'), 'label' => 'Modal Windows Contents'))->setHelps(array('bannercontentblocks' => 'Select the top contents in the order you want them to appear in the Skeleton Page', 'maincontentblocks' => 'Select the main contents in the order you want them to appear in the Skeleton Page', 'modalcontentblocks' => 'Select the contents in the order you want them to appear in the modal windows'))->end()->end();
                 break;
             default:
                 $formMapper->tab('Skeleton Page Contents')->with('Skeleton Page Contents', array('collapsed' => true))->add('maincontentblocks', 'contentblockcollection', array('attr' => array('class' => 'maincontentblocks'), 'label' => 'Main Contents'))->add('modalcontentblocks', 'contentblockcollection', array('attr' => array('class' => 'modalcontentblocks'), 'label' => 'Modal Windows Contents'))->setHelps(array('maincontentblocks' => 'Select the contents in the order you want them to appear in the Skeleton Page', 'modalcontentblocks' => 'Select the contents in the order you want them to appear in the modal windows'))->end()->end();
         }
     }
 }
예제 #19
0
 /**
  * Form fields configuration
  *
  * This function adds Name to the form mapper.
  *
  * @param FormMapper $formMapper
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     $speakerQuery = $this->modelManager->getEntityManager('Protalk\\MediaBundle\\Entity\\Speaker')->createQuery('SELECT s
                               FROM ProtalkMediaBundle:speaker s
                               ORDER BY s.name ASC');
     $formMapper->add('speaker', 'sonata_type_model', array('class' => 'Protalk\\MediaBundle\\Entity\\Speaker', 'property' => 'name', 'query' => $speakerQuery));
 }
예제 #20
0
 /**
  * {@inheritdoc}
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     if (!$this->hasParentFieldDescription()) {
         $formMapper->add('car', null, array('constraints' => new Assert\NotNull()));
     }
     $formMapper->add('date', null, array('widget' => 'single_text'))->add('comment');
 }
예제 #21
0
 /**
  * {@inheritdoc}
  */
 public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
 {
     $ckeditor_toolbar_icons = array(1 => array('Bold', 'Italic', 'Underline', '-', 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo', '-', 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', '-', 'Image', 'Link', 'Unlink', 'Table'), 2 => array('Maximize', 'Source'));
     $formMapper->add('settings', 'sonata_type_immutable_array', array('keys' => array(array('title', 'text', array('required' => false)), array('content', 'sonata_formatter_type', function (FormBuilderInterface $formBuilder) {
         return array('event_dispatcher' => $formBuilder->getEventDispatcher(), 'format_field' => array('format', '[format]'), 'source_field' => array('rawContent', '[rawContent]'), 'target_field' => '[content]', 'ckeditor_toolbar_icons' => array(1 => array('Source', '-', 'Save', 'NewPage', 'DocProps', 'Preview', 'Print', '-', 'Templates'), 2 => array('Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'), 3 => array('Find', 'Replace', '-', 'SelectAll', '-', 'SpellChecker', 'Scayt'), 4 => array('Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'), 5 => array('Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'), 6 => array('NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'CreateDiv', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'BidiLtr', 'BidiRtl'), 7 => array('Link', 'Unlink', 'Anchor'), 8 => array('Image', 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe'), 9 => array('Styles', 'Format', 'Font', 'FontSize'), 10 => array('TextColor', 'BGColor'), 11 => array('Maximize', 'ShowBlocks', '-', 'About')));
     }))));
 }
예제 #22
0
 /**
  * {@inheritdoc}
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     $isSf28 = method_exists('Symfony\\Component\\Form\\AbstractType', 'getBlockPrefix');
     $doctrineTreeType = $isSf28 ? 'Sonata\\DoctrinePHPCRAdminBundle\\Form\\Type\\TreeModelType' : 'doctrine_phpcr_odm_tree';
     $textType = $isSf28 ? 'Symfony\\Component\\Form\\Extension\\Core\\Type\\TextType' : 'text';
     $formMapper->with('form.group_general')->add('parentDocument', $doctrineTreeType, array('root_node' => $this->getRootPath(), 'choice_list' => array(), 'select_root_node' => true))->add('name', $textType)->add('actionName', $textType)->end();
 }
 protected function configureFormFields(FormMapper $formMapper)
 {
     if ($this->getRequest()->get('_sonata_admin') == 'sonata.admin.indicador_alertas') {
         $formMapper->add('indicador', null, array('label' => $this->getTranslator()->trans('indicador')));
     }
     $formMapper->add('limiteInferior', null, array('label' => $this->getTranslator()->trans('_alerta_limite_inferior_'), 'required' => true))->add('limiteSuperior', null, array('label' => $this->getTranslator()->trans('limite_superior'), 'required' => true))->add('color', null, array('label' => $this->getTranslator()->trans('color'), 'required' => true))->add('comentario', null, array('label' => $this->getTranslator()->trans('comentario')));
 }
예제 #24
0
 /**
  * {@inheritdoc}
  */
 public function configureFormFields(FormMapper $formMapper)
 {
     if (!$this->isChild()) {
         $formMapper->with($this->trans('invoice.form.group_main_label', array(), $this->translationDomain))->add('customer', 'sonata_type_model_list')->end();
     }
     $formMapper->with($this->trans('invoice.form.group_main_label', array(), $this->translationDomain))->add('reference')->add('currency', 'sonata_currency')->add('status', 'sonata_invoice_status', array('translation_domain' => $this->translationDomain))->add('totalExcl')->add('totalInc')->end()->with($this->trans('invoice.form.group_billing_label', array(), $this->translationDomain), array('collapsed' => true))->add('name')->add('phone')->add('address1')->add('address2')->add('address3')->add('city')->add('postcode')->add('country', 'country')->add('fax')->add('email')->add('mobile')->end();
 }
예제 #25
0
 /**
  * {@inheritdoc}
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->add('name')->add('description', 'textarea', array('required' => false))->add('context')->add('enabled', null, array('required' => false));
     if (interface_exists('Sonata\\MediaBundle\\Model\\MediaInterface')) {
         $formMapper->add('media', 'sonata_type_model_list', array('required' => false), array('link_parameters' => array('provider' => 'sonata.media.provider.image', 'context' => 'sonata_collection')));
     }
 }
예제 #26
0
 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('video', 'iphp_file', array('label' => 'Видео', 'required' => false, 'help' => 'Загрузить флеш-видео в формате .flv'))->add('priority', null, array('label' => 'Приоритет', 'required' => false))->add('created', null, array('label' => 'Дата создания', 'required' => false))->add('videos', 'sonata_type_collection', array('label' => 'Видео файлы', 'by_reference' => false, 'cascade_validation' => true, 'required' => false), array('edit' => 'inline', 'inline' => 'table', 'allow_delete' => true))->add('enabled', null, array('label' => 'Активен', 'required' => false));
 }
예제 #27
0
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->with('form.group_general', array('translation_domain' => 'CmfRoutingBundle'))->add('parentDocument', TreeModelType::class, array('choice_list' => array(), 'select_root_node' => true, 'root_node' => $this->routeRoot))->add('name', TextType::class)->end();
     if (null === $this->getParentFieldDescription()) {
         $formMapper->with('form.group_general', array('translation_domain' => 'CmfRoutingBundle'))->add('content', TreeModelType::class, array('choice_list' => array(), 'required' => false, 'root_node' => $this->contentRoot))->end()->with('form.group_advanced', array('translation_domain' => 'CmfRoutingBundle'))->add('variablePattern', TextType::class, array('required' => false), array('help' => 'form.help_variable_pattern'))->add('defaults', ImmutableArrayType::class, array('keys' => $this->configureFieldsForDefaults($this->getSubject()->getDefaults())))->add('options', ImmutableArrayType::class, array('keys' => $this->configureFieldsForOptions($this->getSubject()->getOptions())), array('help' => 'form.help_options'))->end()->end();
     }
 }
예제 #28
0
 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' => 'Nom d\'utilisateur'))->add('plainPassword', 'repeated', array('type' => 'password', 'options' => array('translation_domain' => 'FOSUserBundle'), 'first_options' => array('label' => 'Mot de passe'), 'second_options' => array('label' => 'Confirmation du mot de passe'), 'invalid_message' => 'fos_user.password.mismatch'))->add('email', 'email', array('label' => 'Adresse email', 'attr' => array('placeholder' => 'Entrez votre adresse email')))->add('roles', 'choice', array('choices' => $rolesChoices, 'multiple' => true))->add('subjects', 'sonata_type_model', array('label' => 'Sujets de discussion', 'by_reference' => true, 'multiple' => true, 'required' => false));
 }
예제 #29
0
 protected function configureFormFields(FormMapper $formMapper)
 {
     $formMapper->with('archer', array('class' => 'col-md-6'))->add('matricule', 'text')->add('firstname', 'text')->add('lastname', 'text')->add('birthday')->add('affiliatedSince')->add('category', EntityType::class, array('class' => 'BAArcheryBundle:Category', 'choice_label' => 'acronym', 'label' => 'Catégorie'))->add('isActif')->end()->with('Competition inscrit', array('class' => 'col-md-6'))->add('inscrit')->end();
     if (!$this->isChild()) {
         $formMapper->with('club', array('class' => 'col-md-6'))->add('club', EntityType::class, array('class' => 'BAArcheryBundle:Club', 'choice_label' => 'acronym', 'label' => 'Club'))->end();
     }
 }
예제 #30
0
 /**
  * {@inheritdoc}
  */
 protected function configureFormFields(FormMapper $formMapper)
 {
     if (!$this->getSubject() || !$this->getSubject()->isInternal() && !$this->getSubject()->isError()) {
         $formMapper->with($this->trans('form_page.group_main_label'))->add('url', 'text', array('attr' => array('readonly' => 'readonly')))->end();
     }
     if ($this->hasSubject() && !$this->getSubject()->getId()) {
         $formMapper->with($this->trans('form_page.group_main_label'))->add('site', null, array('required' => true, 'read_only' => true))->end();
     }
     $formMapper->with($this->trans('form_page.group_main_label'))->add('name')->add('enabled', null, array('required' => false))->add('position')->end();
     if ($this->hasSubject() && !$this->getSubject()->isInternal()) {
         $formMapper->with($this->trans('form_page.group_main_label'))->add('type', 'sonata_page_type_choice', array('required' => false))->end();
     }
     $formMapper->with($this->trans('form_page.group_main_label'))->add('templateCode', 'sonata_page_template', array('required' => true))->add('parent', 'sonata_page_selector', array('page' => $this->getSubject() ?: null, 'site' => $this->getSubject() ? $this->getSubject()->getSite() : null, 'model_manager' => $this->getModelManager(), 'class' => $this->getClass(), 'required' => false), array('link_parameters' => array('siteId' => $this->getSubject() ? $this->getSubject()->getSite()->getId() : null)))->end();
     if (!$this->getSubject() || !$this->getSubject()->isDynamic()) {
         $formMapper->with($this->trans('form_page.group_main_label'))->add('pageAlias', null, array('required' => false))->add('target', 'sonata_page_selector', array('page' => $this->getSubject() ?: null, 'site' => $this->getSubject() ? $this->getSubject()->getSite() : null, 'model_manager' => $this->getModelManager(), 'class' => $this->getClass(), 'filter_choice' => array('request_method' => 'all'), 'required' => false), array('link_parameters' => array('siteId' => $this->getSubject() ? $this->getSubject()->getSite()->getId() : null)))->end();
     }
     if (!$this->getSubject() || !$this->getSubject()->isHybrid()) {
         $formMapper->with($this->trans('form_page.group_seo_label'))->add('slug', 'text', array('required' => false))->add('customUrl', 'text', array('required' => false))->end();
     }
     $formMapper->with($this->trans('form_page.group_seo_label'), array('collapsed' => true))->add('title', null, array('required' => false))->add('metaKeyword', 'textarea', array('required' => false))->add('metaDescription', 'textarea', array('required' => false))->end();
     if ($this->hasSubject() && !$this->getSubject()->isCms()) {
         $formMapper->with($this->trans('form_page.group_advanced_label'), array('collapsed' => true))->add('decorate', null, array('required' => false))->end();
     }
     $formMapper->with($this->trans('form_page.group_advanced_label'), array('collapsed' => true))->add('javascript', null, array('required' => false))->add('stylesheet', null, array('required' => false))->add('rawHeaders', null, array('required' => false))->end();
     $formMapper->setHelps(array('name' => $this->trans('help_page_name')));
 }