/** * {@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); }
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(); } } }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab('User')->with('Profile', array('class' => 'col-md-6'))->end()->with('General', array('class' => 'col-md-6'))->end()->with('Social', array('class' => 'col-md-6'))->end()->end()->tab('Security')->with('Status', array('class' => 'col-md-4'))->end()->with('Groups', array('class' => 'col-md-4'))->end()->with('Keys', array('class' => 'col-md-4'))->end()->with('Roles', array('class' => 'col-md-12'))->end()->end(); $now = new \DateTime(); $formMapper->tab('User')->with('General')->add('username')->add('email')->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->end()->with('Profile')->add('image', 'sonata_type_model_list', array(), array('placeholder' => 'No image selected', 'link_parameters' => array('context' => 'user')))->add('dateOfBirth', 'sonata_type_date_picker', array('years' => range(1900, $now->format('Y')), 'dp_min_date' => '1-1-1900', 'dp_max_date' => $now->format('c'), 'required' => false))->add('firstname', null, array('required' => false))->add('lastname', null, array('required' => false))->add('website', 'url', array('required' => false))->add('biography', 'text', array('required' => false))->add('gender', 'sonata_user_gender', array('required' => true, 'translation_domain' => $this->getTranslationDomain()))->add('locale', 'locale', array('required' => false))->add('timezone', 'timezone', array('required' => false))->add('phone', null, array('required' => false))->end()->with('Social')->add('facebookUid', null, array('required' => false))->add('facebookName', null, array('required' => false))->add('twitterUid', null, array('required' => false))->add('twitterName', null, array('required' => false))->add('gplusUid', null, array('required' => false))->add('gplusName', null, array('required' => false))->end()->end(); $formMapper->tab('Security')->with('Status')->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()->with('Groups')->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->with('Roles')->add('realRoles', 'sonata_security_roles', array('label' => 'form.label_roles', 'expanded' => true, 'multiple' => true, 'required' => false))->end()->end(); $formMapper->tab('Security')->with('Keys')->add('token', null, array('required' => false))->add('twoStepVerificationCode', null, array('required' => false))->end()->end(); }
/** * {@inheritdoc} */ public function configureFormFields(FormMapper $formMapper) { $formMapper->tab('General')->with('General', array('collapsed' => false))->add('username')->add('email')->add('plainPassword', 'text', array('required' => false))->end()->end()->tab('Profile')->with('Profile', array('collapsed' => true))->add('firstname', null, array('label' => 'First Name', 'required' => false))->add('lastname', null, array('label' => 'Surname', 'required' => false))->add('sex', 'choice', array('choices' => array('male' => 'Male', 'female' => 'Female'), 'label' => 'Sex', 'required' => false, 'expanded' => true, 'multiple' => false))->add('bakeFrequency', 'choice', array('choices' => array('year' => 'Once a year', 'month' => 'Once a year', 'week' => 'Every Week'), 'label' => 'How often do you bake?', 'required' => false))->add('bakeChoises', 'choice', array('choices' => array('biscuits' => 'biscuits', 'breads' => 'breads', 'brownies' => 'brownies', 'cakes' => 'cakes', 'cupcakes' => 'cupcakes', 'desserts' => 'desserts', 'muffins' => 'muffins', 'pancakes' => 'pancakes', 'pies' => 'pies'), 'label' => 'Which of the following do you bake?', 'required' => false, 'expanded' => true, 'multiple' => true))->add('children', 'choice', array('choices' => array('no' => 'No', 'yes' => 'Yes'), 'label' => 'Do you have children?', 'required' => false, 'expanded' => true, 'multiple' => false))->add('campaign', null, array('label' => 'Campaign Name', 'required' => false))->end()->end(); if (!$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) { $formMapper->with('Management', array('collapsed' => true))->add('roles', 'sonata_security_roles', array('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(); } $formMapper->tab('Security')->with('Security', array('collapsed' => true))->add('token', null, array('required' => false))->add('twoStepVerificationCode', null, array('required' => false))->end()->end()->tab('Groups')->with('Groups', array('collapsed' => true))->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->end(); }
protected function configureFormFields(FormMapper $formMapper) { $esFusionado = $this->getSubject()->getEsFusionado(); $formMapper->tab($this->getTranslator()->trans('datos_generales'))->with('', array('class' => 'col-md-12'))->end()->end()->tab($this->getTranslator()->trans('_origen_datos_'))->with($this->getTranslator()->trans('origen_datos_sql'), array('class' => 'col-md-8'))->end()->with($this->getTranslator()->trans('origen_datos_archivo'), array('class' => 'col-md-4'))->end()->end(); $formMapper->tab($this->getTranslator()->trans('datos_generales'), array('collapsed' => false))->with('', array('class' => 'col-md-12'))->add('nombre', null, array('label' => $this->getTranslator()->trans('nombre')))->add('descripcion', null, array('label' => $this->getTranslator()->trans('descripcion'), 'required' => false))->end()->end(); if ($esFusionado == false) { $formMapper->tab($this->getTranslator()->trans('datos_generales'), array('collapsed' => false))->with('', array('class' => 'col-md-12'))->add('esCatalogo', null, array('label' => $this->getTranslator()->trans('es_catalogo')))->add('areaCosteo', 'choice', array('label' => $this->getTranslator()->trans('_area_costeo_'), 'choices' => array('rrhh' => $this->getTranslator()->trans('_rrhh_'), 'ga_af' => $this->getTranslator()->trans('_ga_af_')), 'required' => false))->end()->end()->tab($this->getTranslator()->trans('_origen_datos_'), array('collapsed' => true))->with($this->getTranslator()->trans('origen_datos_sql'))->add('conexiones', null, array('label' => $this->getTranslator()->trans('nombre_conexion'), 'required' => false, 'expanded' => false))->add('sentenciaSql', null, array('label' => $this->getTranslator()->trans('sentencia_sql'), 'required' => false, 'attr' => array('rows' => 7, 'cols' => 50)))->end()->with($this->getTranslator()->trans('origen_datos_archivo'))->add('archivoNombre', null, array('label' => $this->getTranslator()->trans('archivo_asociado'), 'required' => false, 'read_only' => true))->add('file', 'file', array('label' => $this->getTranslator()->trans('subir_nuevo_archivo'), 'required' => false))->end()->end(); } }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { // define group zoning $formMapper->tab('Usuario')->with('Perfil', array('class' => 'col-md-12'))->end()->end()->tab('Seguridad')->with('Estado', array('class' => 'col-md-4'))->end()->with('Groups', array('class' => 'col-md-4'))->end()->end(); $now = new \DateTime(); $formMapper->tab('Usuario')->with('Perfil')->add('firstname', null, array('required' => false, 'label' => 'Nombre'))->add('lastname', null, array('required' => false, 'label' => 'Apellido'))->add('username', 'text', array('label' => 'Nombre de Usuario'))->add('email', 'text', array('label' => 'Email'))->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId()), 'label' => 'contraseña'))->end()->end(); if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) { $formMapper->tab('Seguridad')->with('Estado')->add('locked', null, array('required' => false, 'label' => 'Bloqueado'))->add('enabled', null, array('required' => false, 'label' => 'Habilitado'))->add('credentialsExpired', null, array('required' => false, 'label' => 'credenciales vencidas'))->end()->with('Groups')->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->end(); } }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab('General')->with('Basic Info')->add('username')->add('email')->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->end()->end(); $formMapper->tab('Groups & Roles')->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('Roles')->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' => false))->end(); } $formMapper->end()->tab('Info')->with('Profile')->add('dateOfBirth', 'birthday', array('required' => false))->add('firstname', null, array('required' => false))->add('lastname', null, array('required' => false))->add('website', 'url', array('required' => false))->add('biography', 'text', array('required' => false))->add('gender', 'sonata_user_gender', array('required' => true, 'translation_domain' => $this->getTranslationDomain()))->add('locale', 'locale', array('required' => false))->add('timezone', 'timezone', array('required' => false))->add('phone', null, array('required' => false))->end()->with('Social')->add('facebookUid', null, array('required' => false))->add('facebookName', null, array('required' => false))->add('twitterUid', null, array('required' => false))->add('twitterName', null, array('required' => false))->add('gplusUid', null, array('required' => false))->add('gplusName', null, array('required' => false))->end()->end(); $formMapper->tab('Security')->with('Two Step Verification')->add('token', null, array('required' => false))->add('twoStepVerificationCode', null, array('required' => false))->end()->end(); $formMapper->tab('Venues')->add('venues', 'sonata_type_collection', ['label' => 'Venues'])->end(); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { // define group zoning $formMapper->tab('User')->with('Profile', array('class' => 'col-md-6'))->end()->with('General', array('class' => 'col-md-6'))->end()->end()->tab('Addresses')->with('Addresses', array('class' => 'col-md-6'))->end()->end()->tab('Company')->with('Info', array('class' => 'col-md-6'))->end()->end()->tab('Orders')->with('Orders', array('class' => 'col-md-12'))->end()->end()->tab('Security')->with('Status', array('class' => 'col-md-4'))->end()->with('Groups', array('class' => 'col-md-4'))->end()->with('Keys', array('class' => 'col-md-4'))->end()->with('Roles', array('class' => 'col-md-12'))->end()->end(); $now = new \DateTime(); $formMapper->tab('User')->with('General')->add('username')->add('email')->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->end()->with('Profile')->add('firstname', null, array('required' => false))->add('lastname', null, array('required' => false))->add('phone', null, array('required' => false))->add('locale', 'locale', array('required' => false))->end()->end()->tab('Company')->with('Info')->add('company', null, array('required' => false))->add('nip', null, array('required' => false))->add('regon', null, array('required' => false))->end()->end()->tab('Orders')->with('Orders')->add('customerOrders', 'sonata_type_collection', array('label' => 'Orders', 'required' => false, 'by_reference' => false), array('edit' => 'inline', 'inline' => 'standard'))->end()->end()->tab('Addresses')->with('Addresses')->add('addresses', 'sonata_type_collection', array('label' => 'Address', 'required' => false, 'by_reference' => false), array('edit' => 'inline', 'inline' => 'standard'))->end()->end(); if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) { $formMapper->tab('Security')->with('Status')->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()->with('Groups')->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->with('Roles')->add('realRoles', 'sonata_security_roles', array('label' => 'form.label_roles', 'expanded' => true, 'multiple' => true, 'required' => false))->end()->end(); } $formMapper->tab('Security')->with('Keys')->add('token', null, array('required' => false))->add('twoStepVerificationCode', null, array('required' => false))->end()->end(); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $normalUser = $this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN'); $formMapper->tab('Général')->with('Utilisateur', array('class' => 'col-md-6'))->add('username')->add('email')->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->add('firstname')->add('lastname')->add('company', null, array('label' => 'Société'))->add('legalSituation', 'choice', array('choices' => array('ei' => 'Entreprises individuelles', 'sc' => 'Sociétés civiles', 'eurl' => 'EURL', 'sarl' => 'SARL', 'sas' => 'SAS', 'sa' => 'SA'), 'label' => 'Statut juridique :'))->add('phoneNumber', 'text', array('label' => 'Téléphone :'))->add('url', 'url', array('label' => 'Url de votre site :'))->end()->with('Groups', array('class' => 'col-md-6'))->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end(); if ($normalUser) { $formMapper->with('Management', array('class' => 'col-md-6'))->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(); } $formMapper->end(); if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) { $formMapper->tab('Rôles')->add('realRoles', 'sonata_security_roles', array('label' => false, 'expanded' => true, 'multiple' => true, 'required' => false))->end(); } }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab($this->getTranslator()->trans('_general_'))->add('name')->add('roles', 'sonata_security_roles', array('expanded' => true, 'multiple' => true, 'required' => false))->end()->end(); if ($this->getSubject() and !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) { $acciones = explode('/', $this->getRequest()->server->get("REQUEST_URI")); $accion = array_pop($acciones); $accion = explode('?', $accion); if ($accion[0] == 'edit') { $formMapper->tab($this->getTranslator()->trans('_indicadores_y_salas_'))->add('indicadores', null, array('label' => $this->getTranslator()->trans('indicadores'), 'expanded' => true))->add('salas', null, array('label' => $this->getTranslator()->trans('_salas_situacionales_'), 'expanded' => true))->end(); } } }
protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab($this->getTranslator()->trans('ficha_tecnica'))->with($this->getTranslator()->trans('_datos_generales_'), array('class' => 'col-md-8'))->end()->with($this->getTranslator()->trans('_clasificacion_'), array('class' => 'col-md-4'))->end()->end()->tab($this->getTranslator()->trans('_configuracion_'))->with($this->getTranslator()->trans('_dimensiones_'), array('class' => 'col-md-4'))->end()->with($this->getTranslator()->trans('alertas'), array('class' => 'col-md-8'))->end()->end(); $formMapper->tab($this->getTranslator()->trans('ficha_tecnica'))->with($this->getTranslator()->trans('_datos_generales_'))->add('nombre', null, array('label' => $this->getTranslator()->trans('nombre_indicador')))->add('tema', null, array('label' => $this->getTranslator()->trans('_interpretacion_')))->add('concepto', null, array('label' => $this->getTranslator()->trans('concepto')))->add('unidadMedida', null, array('label' => $this->getTranslator()->trans('unidad_medida')))->add('esAcumulado', null, array('label' => $this->getTranslator()->trans('es_acumulado')))->add('variables', null, array('label' => $this->getTranslator()->trans('variables'), 'expanded' => false, 'class' => 'IndicadoresBundle:VariableDato', 'query_builder' => function ($repository) { return $repository->createQueryBuilder('vd')->orderBy('vd.nombre'); }))->add('formula', null, array('label' => $this->getTranslator()->trans('formula'), 'help' => $this->getTranslator()->trans('ayuda_ingreso_formula')))->add('periodo', null, array('label' => $this->getTranslator()->trans('periodicidad')))->add('confiabilidad', null, array('label' => $this->getTranslator()->trans('confiabilidad'), 'required' => false))->add('reporte', null, array('label' => $this->getTranslator()->trans('_reporte_'), 'required' => false))->add('observacion', 'textarea', array('label' => $this->getTranslator()->trans('_observacion_'), 'required' => false))->end()->with($this->getTranslator()->trans('_clasificacion_'))->add('clasificacionTecnica', null, array('label' => $this->getTranslator()->trans('clasificacion_tecnica'), 'required' => true, 'expanded' => true, 'class' => 'IndicadoresBundle:ClasificacionTecnica', 'query_builder' => function ($repository) { return $repository->createQueryBuilder('ct')->orderBy('ct.clasificacionUso'); }))->add('clasificacionPrivacidad', null, array('label' => $this->getTranslator()->trans('_nivel_de_usuario_'), 'expanded' => true))->end()->end()->tab($this->getTranslator()->trans('_configuracion_'))->with($this->getTranslator()->trans('alertas'))->add('alertas', 'sonata_type_collection', array('label' => $this->getTranslator()->trans('alertas'), 'required' => true), array('edit' => 'inline', 'inline' => 'table', 'sortable' => 'position'))->end()->with($this->getTranslator()->trans('_dimensiones_'))->add('camposIndicador', null, array('label' => $this->getTranslator()->trans('campos_indicador')))->end()->end(); $acciones = explode('/', $this->getRequest()->server->get("REQUEST_URI")); $accion = array_pop($acciones); if ($accion == 'create') { $formMapper->setHelps(array('camposIndicador' => $this->getTranslator()->trans('_debe_guardar_para_ver_dimensiones_'))); } }
/** * @param FormMapper $formMapper */ protected function configureFormFields(FormMapper $formMapper) { $user = $this->getConfigurationPool()->getContainer()->get('security.context')->getToken()->getUser(); $conn = $this->getConfigurationPool()->getContainer()->get('database_connection'); $cates = $conn->fetchAll("select id, name from map2u_core__layer_category where user_uuid='" . $user->getId() . "'"); $categorylist = array(); foreach ($cates as $cate) { $categorylist[$cate['id']] = $cate['name']; } $sldFiles = array(); $path = $this->container->get('kernel')->getRootDir() . '/../Data'; $user = $this->container->get('security.context')->getToken()->getUser(); if (file_exists($path . '/sld/' . $user->getId())) { foreach (glob($path . '/sld/' . $user->getId() . '/*.sld') as $file) { $file1 = substr($file, 0, strrpos($file, '/', -1)); $file2 = substr($file, 0, strrpos($file1, '/', -1)); $sldFiles[substr($file, strlen($file2) + 1)] = substr($file, strlen($file2) + 1); } } foreach (glob($path . '/sld/*.sld') as $file) { $sldFiles[substr($file, strrpos($file, '/', -1) + 1)] = substr($file, strrpos($file, '/', -1) + 1); } $spatialfile_class = $this->getConfigurationPool()->getContainer()->getParameter('map2u.core.spatialfile.class'); $layercategory_class = $this->getConfigurationPool()->getContainer()->getParameter('map2u.core.layercategory.class'); $category_class = $this->getConfigurationPool()->getContainer()->getParameter('map2u.core.category.class'); $formMapper->tab('General')->with('Layer', array('class' => 'col-md-6'))->add('id', 'hidden')->add('name')->add('user')->add('spatialfile', 'entity', array('class' => $spatialfile_class, 'required' => false, 'multiple' => false, 'expanded' => false))->add('layerCategory', 'entity', array('class' => "Map2u\\CoreBundle\\Entity\\LayerCategory", 'required' => false, 'multiple' => false, 'expanded' => false))->add('category', 'entity', array('class' => "Map2u\\CoreBundle\\Entity\\Category", 'required' => false, 'multiple' => false, 'expanded' => false))->add('enabled')->add('public')->add('position')->end()->with('Layer Translation', array('class' => 'col-md-6'))->add('translations', 'a2lix_translations', array('by_reference' => false, 'required' => false))->end()->end()->tab('WMS and WFS Layer')->with('WMS and WFS Layer Settings', array('class' => 'col-md-6'))->add('hostName', 'text', array('mapped' => false, 'required' => false))->add('layerName', 'text', array('mapped' => false, 'required' => false))->add('srs', 'text', array('mapped' => false, 'required' => false))->add('layerType', 'choice', array('mapped' => false, 'choices' => array('wms' => 'WMS', 'wfs' => 'WFS')))->end()->end()->tab('Heat Map Layer')->with('Heat Map Layer Settings', array('class' => 'col-md-6'))->add('fieldname', 'text', array('mapped' => false, 'required' => false))->add('radius', 'text', array('mapped' => false, 'required' => false))->add('opacity', 'number', array('mapped' => false, 'required' => false))->add('gradient', 'text', array('mapped' => false, 'required' => false))->end()->end()->tab('Cluster Layer')->with('Cluster Settings', array('class' => 'col-md-6'))->add('showCoverageOnHover', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('zoomToBoundsOnClick', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('spiderfyOnMaxZoom', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('removeOutsideVisibleBounds', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('animateAddingMarkers', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('disableClusteringAtZoom', 'integer', array('mapped' => false, 'required' => false))->add('maxClusterRadius', 'number', array('mapped' => false, 'required' => false, 'data' => 80))->add('polygonOptions', 'text', array('mapped' => false, 'required' => false))->add('singleMarkerMode', 'checkbox', array('mapped' => false, 'required' => false, 'data' => true))->add('spiderfyDistanceMultiplier', 'integer', array('mapped' => false, 'required' => false, 'data' => 1))->add('iconCreateFunction', 'text', array('mapped' => false, 'required' => false))->end()->end()->tab('Style and Settings')->with('Layer Style', array('class' => 'col-md-6'))->add('shared')->add('layerProperty')->add('showLabel')->add('defaultShowOnMap')->add('layerShowInSwitcher')->add('zoomLevel')->add('defaultSldName', 'choice', array('mapped' => false, 'choices' => $sldFiles, 'label' => 'Default SLD File'))->add('uploadSldName', 'file', array('mapped' => false, 'required' => false, 'label' => 'Upload SLD File', 'attr' => array('style' => 'border: none')))->end()->with('Layer Settings', array('class' => 'col-md-6'))->add('lat')->add('lng')->add('type')->add('valueField')->add('sld')->add('sqltext')->end()->end(); }
protected function configureFormFields(FormMapper $formMapper) { $subscriber = new AddMenuTypeFieldSubscriber($formMapper->getFormBuilder()->getFormFactory()); $formMapper->getFormBuilder()->addEventSubscriber($subscriber); // Getting the container parameters set in the config file that exist $menuSettings = $this->getConfigurationPool()->getContainer()->getParameter('menu_settings'); // Setting up the available actions $actionsChoice = $menuSettings['actions']; reset($actionsChoice); $prefActionsChoice = key($actionsChoice); // Setting up the available menu types $menuTypeChoice = $menuSettings['menutypes']; reset($menuTypeChoice); $prefMenuTypeChoice = key($menuTypeChoice); // Setting up the available menu groups $menuGroupsChoice = $menuSettings['menugroups']; reset($menuGroupsChoice); $prefMenuGroupsChoice = key($menuGroupsChoice); // Setting up the available page types and preffered choice $accessLevelChoices = $menuSettings['accessLevel']; reset($accessLevelChoices); $prefAccessLevelChoices = key($accessLevelChoices); // Setting up the available publish states and preffered choice $publishStateChoices = $menuSettings['publishState']; reset($publishStateChoices); $prefPublishStateChoices = key($publishStateChoices); $menus = $this->getConfigurationPool()->getContainer()->get('doctrine.orm.entity_manager')->getRepository('MenuBundle:Menu')->findAll(); $menusChoice['-'] = 'Hide From Menu'; $menusChoice['0'] = 'Menu Root'; foreach ($menus as $menu) { $menusChoice[$menu->getId()] = $menu->getTitle() . ' (' . $menu->getMenuGroup() . ')'; } $formMapper->tab('Menu Item Essential Details')->with('Menu Item Essential Details', array('collapsed' => true))->add('title', null, array('label' => 'Title', 'required' => true))->add('menuType', 'choice', array('choices' => $menuTypeChoice, 'preferred_choices' => array($prefMenuTypeChoice), 'label' => 'Menu Item Type', 'required' => true))->add('route', 'choice', array('choices' => $actionsChoice, 'preferred_choices' => array($prefActionsChoice), 'label' => 'Link Action', 'required' => true))->setHelps(array('title' => 'Set the title of the menu item (link copy text)', 'menuType' => 'Set the type of the menu item linked page', 'route' => 'Select the action of the menu item'))->end()->end()->tab('Menu Item Taxonomy')->with('Menu Item Taxonomy', array('collapsed' => true))->add('menuGroup', 'choice', array('choices' => $menuGroupsChoice, 'preferred_choices' => array($prefMenuGroupsChoice), 'label' => 'Menu Group', 'required' => true))->add('parent', 'choice', array('choices' => $menusChoice, 'attr' => array('class' => 'autoCompleteItems autoCompleteMenus', 'data-sonata-select2' => 'false'), 'label' => 'Parent Menu Item', 'required' => false))->add('ordering', null, array('label' => 'Menu Item Order', 'required' => true))->setHelps(array('menuGroup' => 'Set the menu group this menu item belongs to', 'parent' => 'Select the parent menu item', 'ordering' => 'Set the order of the menu item in accordance to the other menu items of the same menu level'))->end()->end()->tab('Menu Item Access Control')->with('Menu Item Access Control', array('collapsed' => true))->add('accessLevel', 'choice', array('choices' => $accessLevelChoices, 'preferred_choices' => array($prefAccessLevelChoices), 'label' => 'Access Level', 'required' => true))->add('publishState', 'choice', array('choices' => $publishStateChoices, 'preferred_choices' => array($prefPublishStateChoices), 'label' => 'Publish State', 'required' => true))->setHelps(array('accessLevel' => 'Set the minimum access level the item is visible to', 'publishState' => 'Set the publish state of this menu item'))->end()->end()->tab('Menu Item Optional Details')->with('Menu Item Optional Details', array('collapsed' => true))->add('menuImage', 'sonata_media_type', array('provider' => 'sonata.media.provider.image', 'context' => 'icons', 'attr' => array('class' => 'imagefield'), 'label' => 'Menu Icon Image', 'required' => false))->setHelps(array('menuImage' => 'Set an image as Menu Icon'))->end(); }
/** * @param FormMapper $formMapper */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab('Text')->with('Text')->add('author')->add('shortText')->add('text')->add('createdDate')->add('status', 'choice', array('choices' => array(UserPost::STATUS_PUBLISH => 'PUBLISH', UserPost::STATUS_HIDDEN => 'HIDDEN')))->add('title')->add('isPopular', 'choice', array('choices' => array(UserPost::STATUS_POPULAR => 'POPULAR', UserPost::STATUS_NOT_POPULAR => 'NOT POPULAR')))->end()->end(); // ->tab('Text2') //// ->add('author', 'text', array('label' => 'Post Title')) // ->end(); }
protected function configureFormFields(FormMapper $formMapper) { $query = $this->modelManager->getEntityManager('DN\\TMBundle\\Entity\\Category')->createQuery('SELECT c FROM DN\\TMBundle\\Entity\\Category c WHERE c.isMain = false'); // $arrayType = $query->getArrayResult(); // var_dump($arrayType);die; $formMapper->tab('General')->with('Category')->add('id', 'text', array('label' => 'label.id', 'required' => false, 'read_only' => true, 'disabled' => true))->add('kvsId', 'text', array('label' => 'label.kvsId', 'required' => false, 'read_only' => true, 'disabled' => true))->add('title', 'text', array('label' => 'label.title'))->add('slug', 'text', array('label' => 'page url'))->add('kvsName', 'text', array('label' => 'kvs name', 'read_only' => true, 'disabled' => true, 'required' => false))->add('active', null, array('label' => 'active', 'required' => false))->add('isMain', null, array('label' => 'is main?', 'required' => false))->add('isShownInLists', null, array('label' => 'is shown in menu lists?', 'required' => false))->add('parent', 'sonata_type_model', array('label' => 'label.parent', 'required' => false, 'btn_add' => false, 'property' => 'detailedName'))->end()->end()->tab('SEO')->with('SEO data')->add('seoFields', 'collection', array('label' => 'label.seoFields', 'by_reference' => false, 'type' => $this->container->get('dn.tm.form.type.category_seo'), 'required' => false, 'allow_add' => true, 'allow_delete' => true))->end()->end(); }
public function testGroupRemovingWithTabAndWithTabRemoving() { $this->formMapper->tab('mytab')->with('foobar'); $this->formMapper->removeGroup('foobar', 'mytab', true); $this->assertSame(array(), $this->admin->getFormGroups()); $this->assertSame(array(), $this->admin->getFormTabs()); }
/** * @param \Sonata\AdminBundle\Form\FormMapper $formMapper */ protected function configureFormFields(FormMapper $formMapper) { if ($this->hasProvider()) { // define group zoning $formMapper->tab('Media')->with('bruery_gallery_has_media_media', array('class' => 'col-md-12'))->end()->end()->tab('Settings')->with('bruery_gallery_has_media_settings', array('class' => 'col-md-6'))->end()->end(); } else { // define group zoning $formMapper->tab('Media')->with('bruery_gallery_has_media_media', array('class' => 'col-md-12'))->end()->end(); } $formMapper->tab('Media')->with('bruery_gallery_has_media_media', array('class' => 'col-md-12'))->add('media', 'sonata_type_model_list', array('required' => false), array('link_parameters' => $this->getMediaSettings()))->add('enabled', null, array('required' => false))->add('position', 'hidden')->end()->end(); if ($this->hasProvider()) { $instance = $this->getSubject(); if ($instance && $instance->getId()) { $this->provider->load($instance); $this->provider->buildEditForm($formMapper); } else { $this->provider->buildCreateForm($formMapper); } } }
/** * {@inheritdoc} * @throws \RuntimeException */ protected function configureFormFields(FormMapper $formMapper) { $subject = $this->getSubject(); $formMapper->tab('General')->with('General'); if ($subject instanceof MediaFile) { $formMapper->add('fileLocation', 'text', array('label' => 'File location on server')); } if ($subject instanceof MediaUrl) { $formMapper->add('url', 'text', array('label' => 'URL to videofile')); } $formMapper->end()->end(); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_general', array('class' => 'col-md-8'))->end()->with('tab.group.bruery_classification_category_options', array('class' => 'col-md-4'))->end()->end(); if ($this->hasProvider()) { $formMapper->tab('tab.bruery_classification_category_settings')->with('tab.group.bruery_classification_category_settings', array('class' => 'col-md-8'))->end()->end(); } $formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_general')->add('name')->add('description', 'textarea', array('required' => false))->end()->end(); if ($this->hasSubject()) { if ($this->getSubject()->getParent() !== null || $this->getSubject()->getId() === null) { // root category cannot have a parent $formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_general')->add('parent', 'sonata_category_selector', array('category' => $this->getSubject() ?: null, 'model_manager' => $this->getModelManager(), 'class' => $this->getClass(), 'required' => true, 'context' => $this->getSubject()->getContext() ?: $this->getDefaultContext()))->end()->end(); } } $position = $this->hasSubject() && !is_null($this->getSubject()->getPosition()) ? $this->getSubject()->getPosition() : 0; $formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_options')->add('enabled', null, array('required' => false))->add('position', 'integer', array('required' => false, 'data' => $position))->end()->end(); if (interface_exists('Sonata\\MediaBundle\\Model\\MediaInterface')) { $formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_general')->add('media', 'sonata_type_model_list', array('required' => false), array('link_parameters' => array('provider' => 'sonata.media.provider.image', 'context' => 'sonata_category')))->end()->end(); } if ($this->hasProvider()) { $instance = $this->getSubject(); if ($instance && $instance->getId()) { $this->provider->load($instance); $this->provider->buildEditForm($formMapper); } else { $this->provider->buildCreateForm($formMapper); } } }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $context = $this->getPersistentParameter('context'); if (!$context) { $context = $this->pool->getDefaultContext(); } $formats = array(); foreach ((array) $this->pool->getFormatNamesByContext($context) as $name => $options) { $formats[$name] = $name; } $contexts = array(); foreach ((array) $this->pool->getContexts() as $contextItem => $format) { $contexts[$contextItem] = $contextItem; } $mediaFieldOptions = array('edit' => 'inline', 'sortable' => 'position', 'link_parameters' => $this->getPersistentParameters(), 'admin_code' => 'sonata.media.admin.gallery_has_media'); if ($this->hasChildGalleryProvider()) { $mediaFieldOptions['inline'] = 'standard'; $mediaTabSettings = array('class' => 'col-md-8'); } else { $mediaFieldOptions['inline'] = 'table'; $mediaTabSettings = array('class' => 'col-md-12'); } if ($this->hasGalleryProvider()) { $formMapper->tab('Details')->with('bruery_gallery_settings', array('class' => 'col-md-8'))->end()->with('bruery_gallery_options', array('class' => 'col-md-4'))->end()->end()->tab('Media')->with('bruery_gallery_gallery', $mediaTabSettings)->end()->end(); } else { $formMapper->tab('Details')->with('bruery_gallery_options', array('class' => 'col-md-8'))->end()->end()->tab('Media')->with('bruery_gallery_gallery', $mediaTabSettings)->end()->end(); } $formMapper->tab('Details')->with('bruery_gallery_options')->add('enabled', null, array('required' => false))->add('name')->add('defaultFormat', 'choice', array('choices' => $formats))->end()->end(); $formMapper->tab('Media')->with('bruery_gallery_gallery')->add('galleryHasMedias', 'sonata_type_collection', array('cascade_validation' => true), $mediaFieldOptions)->end()->end(); if ($this->hasGalleryProvider()) { $instance = $this->getSubject(); if ($instance && $instance->getId()) { $this->galleryProvider->load($instance); $this->galleryProvider->buildEditForm($formMapper); } else { $this->galleryProvider->buildCreateForm($formMapper); } } }
protected function configureFormFields(FormMapper $formMapper) { // $container = $this->getConfigurationPool()->getContainer(); $ptHints = ''; $paramPageTypes = $this->container->getParameter('page_types'); $i = 0; foreach ($paramPageTypes as $key => $ppt) { $ptHints .= $key; if ($i < count($paramPageTypes) - 1) { $ptHints .= ', '; } $i++; } $formMapper->tab('General')->with('Product')->add('id', 'text', array('label' => 'label.id', 'required' => false, 'read_only' => true, 'disabled' => true))->add('title', 'text', array('label' => 'label.title', 'required' => false))->add('pageType', 'text', array('label' => 'label.effectedPageTypes' . ' (' . $ptHints . ')', 'required' => false, 'attr' => array('class' => 'bfi-page-types')))->add('pageIds', 'text', array('label' => 'label.effectedPageIds', 'required' => false, 'attr' => array('class' => 'bfi-page-ids', 'disabled' => 'disabled')))->add('categories', 'sonata_type_model', array('multiple' => true, 'label' => 'label.categories', 'required' => false, 'property' => 'detailedName', 'btn_add' => false))->add('active', null, array('label' => 'label.active', 'required' => false))->end()->end()->tab('General')->with('Blocks')->add('pageBlocks', 'collection', array('label' => 'label.displayedBlocks', 'type' => $this->container->get('dn.tm.form.type.page_block'), 'allow_add' => true, 'allow_delete' => true))->end()->end(); }
protected function configureFormFields(FormMapper $formMapper) { $subject = $this->getSubject(); $readonly = false; if ($this->id($subject)) { $readonly = true; } $formMapper->tab('general'); $formMapper->with('customer', array('class' => 'order col-md-4')); $formMapper->add('partner', 'sonata_type_model_autocomplete', array('label' => false, 'property' => 'name', 'read_only' => $readonly), array('admin_code' => 'app.customer')); $formMapper->end(); $class = 'order col-md-6'; $formMapper->with('order_data', array('class' => 'order col-md-4'))->add('id', null, array('label' => 'order_id', 'read_only' => true))->add('orderDate', 'date', array('label' => 'orderdate', 'widget' => 'single_text'))->add('shippingTerm', null, array('horizontal_input_wrapper_class' => array('class' => 'XXXX')))->add('paymentTerm')->end(); $formMapper->with('more_order_data', array('class' => 'order col-md-4'))->add('state', 'choice', array('label' => 'state', 'choices' => SaleOrder::getStateChoices()))->end(); $formMapper->with('invoiceaddress', array('class' => $class))->add('invoiceName', null, array('label' => 'name', 'required' => false))->add('invoiceStreet1', null, array('label' => 'street', 'required' => false))->add('invoiceStreet2', null, array('label' => 'street_addon', 'required' => false))->add('invoiceZip', null, array('label' => 'zip', 'required' => false))->add('invoiceCity', null, array('label' => 'city', 'required' => false))->add('invoiceCountry', 'country', array('label' => 'country', 'attr' => array('class' => 'country'), 'required' => false))->end()->with('shippingaddress', array('class' => $class))->add('shippingName', null, array('label' => 'name', 'required' => false))->add('shippingStreet1', null, array('label' => 'street', 'required' => false))->add('shippingStreet2', null, array('label' => 'street_addon', 'required' => false))->add('shippingZip', null, array('label' => 'zip', 'required' => false))->add('shippingCity', null, array('label' => 'city', 'required' => false))->add('shippingCountry', 'country', array('label' => 'country', 'attr' => array('class' => 'country'), 'required' => false))->end()->with('memo', array('class' => 'order col-md-12'))->add('orderDate', 'date', array('label' => 'orderdate', 'widget' => 'single_text'))->add('memo', 'textarea', array('label' => false, 'required' => false))->end()->end()->tab('positions')->add('saleOrderLines', 'sonata_type_collection', array('by_reference' => false), array('edit' => 'inline', 'inline' => 'table'))->add('amountUntaxed', 'money', array('label' => 'amount_untaxed', 'currency' => 'CHF', 'read_only' => true, 'required' => false))->add('amountTotal', 'money', array('label' => 'amount_total', 'currency' => 'CHF', 'read_only' => true, 'required' => false))->end(); }
protected function configureFormFields(FormMapper $formMapper) { $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getEntityManager(); // $locale = $this->getConfigurationPool()->getContainer()->get('request_stack')->getCurrentRequest()->getLocale(); // $formMapper->add('translations', 'a2lix_translations'); /* $formMapper ->add('productCategory', 'entity', array( 'required' => true, 'class' => "AppBundle\Entity\ProductCategory", 'query_builder' => function(EntityRepository $er) use ($locale) { return $er->createQueryBuilder('u') ->join('u.translations', 'ctr') ->where('ctr.locale = :locale') ->orderBy('ctr.name', 'asc') ->setParameter('locale',$locale) ; }, )); */ $formMapper->setAdminCode("app.partner"); $formMapper->tab('general')->with('options', array('class' => 'col-md-2'))->add('active', null, array('required' => false), array('admin-code' => 'app.partner'))->add('company', null, array('required' => false))->add('customer', null, array('required' => false, 'attr' => array('class' => 'selling')))->add('supplier', null, array('required' => false, 'attr' => array('class' => 'purchase')))->add('isEmployee', null, array('required' => false, 'attr' => array('class' => 'employee')))->end()->with('name.and.address', array('class' => 'col-md-5'))->add('address', 'text', array('required' => false, 'label' => false, 'mapped' => false, 'attr' => array('class' => 'geocomplete')))->add('name', null, array('attr' => array('data-geo' => 'name')))->add('parent', null, array('label' => 'Company'))->add('addressType', 'choice', array('required' => false, 'choices' => Partner::getAddressTypeChoices()))->add('street', null, array('attr' => array('class' => 'street')))->add('street2', null, array('required' => false, 'attr' => array('class' => 'street2')))->add('zip', null, array('attr' => array('data-geo' => 'postal_code')))->add('city', null, array('attr' => array('data-geo' => 'locality')))->add('state', null, array('attr' => array('data-geo' => 'administrative_area_level_1')))->add('country', 'country', array('label' => 'country', 'attr' => array('class' => 'country')))->end()->with('further.information', array('class' => 'col-md-5'))->add('language', 'locale', array('preferred_choices' => array('de_CH')))->add('phone', null, array('required' => false, 'attr' => array('data-geo' => 'international_phone_number')))->add('fax', null, array('required' => false))->add('mobile', null, array('required' => false))->add('email', null, array('required' => false))->add('website', null, array('required' => false, 'attr' => array('data-geo' => 'website')))->add('optOut', null, array('required' => false))->add('partnerCategory')->end()->end()->tab('selling')->with('selling')->add('deliveryMethod', 'sonata_type_model')->add('creditLimit', null, array('required' => false))->end()->end()->tab('purchase')->with('selling')->add('debitLimit', null, array('required' => false))->end()->end()->tab('employee')->with('employee')->add('employee', 'sonata_type_admin', array('required' => false, 'btn_add' => false, 'btn_delete' => false), array('admin_code' => 'app.employee'))->end()->end()->tab('comments')->with('comments')->add('comment', null, array('required' => false, 'label' => false))->end()->end(); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab('fp.label.admin.publication.tab_main')->with('')->add('Title', null, array('label' => 'fp.label.admin.publication.title', 'constraints' => array(new Length(array('max' => 255, 'minMessage' => 'fp.constraint.longer_than_255')))))->add('Content', $this->content_editor, array('label' => 'fp.label.admin.publication.content'))->add('IsPublished', null, array('label' => 'fp.label.admin.publication.is_published', 'required' => false))->end()->end()->tab('fp.label.admin.publication.tab_image')->with('')->add('CroppableImage', 'croppable', array('translation_domain' => $this->getTranslationDomain(), 'label' => 'fp.label.admin.publication.image', 'width' => 140, 'height' => 95))->end()->end()->tab('fp.label.admin.publication.tab_additional')->with('')->add('Slug', null, array('label' => 'fp.label.admin.publication.slug', 'constraints' => array(new Regex(array('pattern' => '/^[\\w\\-]+$/', 'message' => 'fp.constraint.not_alphanumeric')))))->add('Announcement', null, array('label' => 'fp.label.admin.publication.announcement'))->add('CreatedAt', 'datetime_no_intl_picker', array('label' => 'fp.label.admin.publication.created_at', 'format' => $this->datetime_format, 'required' => false))->end()->end()->setHelps(array('Slug' => 'fp.label.admin.hint.slug', 'Announcement' => 'fp.label.admin.hint.announcement', 'CreatedAt' => 'fp.label.admin.hint.created_at')); }
protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab('user.user')->with('user.profile', array('class' => 'col-md-12'))->add('email', 'email', array('label' => 'user.field.email'))->add('firstname', 'text', array('label' => 'user.field.firstname'))->add('lastname', 'text', array('label' => 'user.field.lastname'))->add('birthday', 'birthday', array('required' => false, 'label' => 'user.field.birth_day'))->add('mobilephone', 'text', array('required' => false, 'label' => 'user.field.mobile_phone'))->add('address', 'text', array('required' => false, 'label' => 'user.field.address'))->add('zipcode', 'number', array('required' => false, 'label' => 'user.field.zipcode'))->add('city', 'text', array('required' => false, 'label' => 'user.field.city'))->add('availability', 'textarea', array('required' => false, 'label' => 'user.field.availability'))->end()->end(); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab('Group')->with('General', array('class' => 'col-md-6'))->add('name')->end()->end()->tab('Security')->with('Roles', array('class' => 'col-md-12'))->add('roles', 'sonata_security_roles', array('expanded' => true, 'multiple' => true, 'required' => false))->end()->end(); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $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()->end(); }
/** * @param FormMapper $formMapper */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab('Product')->with('Product', array('class' => 'col-md-12'))->end()->end()->tab('Options')->with('Shipping', array('class' => 'col-md-6'))->end()->with('Parameters', array('class' => 'col-md-6'))->end()->end(); $formMapper->tab('Product')->with('Product')->add('name')->add('price')->add('description')->add('stock')->add('category')->add('productMedias', 'sonata_type_collection', array('label' => 'Media', 'required' => false, 'by_reference' => false), array('edit' => 'inline', 'inline' => 'table'))->end()->end()->tab('Options')->with('Shipping')->add('weight')->add('shippingPackage')->add('shippingCalculationType')->end()->with('Parameters')->add('productParameters', 'sonata_type_collection', array('label' => 'Parameters', 'required' => false, 'by_reference' => false), array('edit' => 'inline', 'inline' => 'table'))->end()->end(); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { $formMapper->tab('Administrative')->with(null)->add('parent')->add('enabled', 'checkbox', ['required' => false])->add('imageFile', 'file', ['required' => false])->end()->end()->tab('Translations')->with(null)->add('translations', 'a2lix_translations_gedmo', ['translatable_class' => 'AppBundle\\Entity\\Category', 'fields' => ['title' => ['locale_options' => ['uk' => ['required' => true], 'en' => ['required' => true], 'ru' => ['required' => true]]]]])->end()->end(); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { // define group zoning $formMapper->tab('User')->with('Profile', array('class' => 'col-md-6'))->end()->with('General', array('class' => 'col-md-6'))->end()->with('Social', array('class' => 'col-md-6'))->end()->end()->tab('Security')->with('Status', array('class' => 'col-md-4'))->end()->with('Groups', array('class' => 'col-md-4'))->end()->with('Keys', array('class' => 'col-md-4'))->end()->with('Roles', array('class' => 'col-md-12'))->end()->end()->tab('ExtraFields')->with('ExtraFields', array('class' => 'col-md-4'))->end()->end(); $now = new \DateTime(); $formMapper->tab('User')->with('General')->add('username')->add('email')->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->end()->with('Profile')->add('dateOfBirth', 'sonata_type_date_picker', array('years' => range(1900, $now->format('Y')), 'dp_min_date' => '1-1-1900', 'dp_max_date' => $now->format('c'), 'required' => false))->add('firstname', null, array('required' => false))->add('lastname', null, array('required' => false))->add('website', 'url', array('required' => false))->add('biography', 'text', array('required' => false))->add('gender', 'sonata_user_gender', array('required' => true, 'translation_domain' => $this->getTranslationDomain()))->add('locale', 'locale', array('required' => false))->add('timezone', 'timezone', array('required' => false))->add('phone', null, array('required' => false))->end()->with('Social')->add('facebookUid', null, array('required' => false))->add('facebookName', null, array('required' => false))->add('twitterUid', null, array('required' => false))->add('twitterName', null, array('required' => false))->add('gplusUid', null, array('required' => false))->add('gplusName', null, array('required' => false))->end()->end(); if ($this->getSubject() && !$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) { $formMapper->tab('Security')->with('Status')->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()->with('Groups')->add('groups', 'sonata_type_model', array('required' => false, 'expanded' => true, 'multiple' => true))->end()->with('Roles')->add('realRoles', 'sonata_security_roles', array('label' => 'form.label_roles', 'expanded' => true, 'multiple' => true, 'required' => false))->end()->end(); } $formMapper->tab('Security')->with('Keys')->add('token', null, array('required' => false))->add('twoStepVerificationCode', null, array('required' => false))->end()->end(); $formMapper->tab('ExtraFields')->with('ExtraFields')->add('extraFields', 'sonata_type_collection', array('cascade_validation' => true), array('allow_delete' => true, 'by_reference' => false, 'edit' => 'inline', 'inline' => 'table', 'admin_code' => 'sonata.admin.user_field_values'))->end()->end(); }