/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { // define group zoning $formMapper->with($this->trans('form_dashboard.group_main_label'), array('class' => 'col-md-12'))->end(); $formMapper->with($this->trans('form_dashboard.group_main_label'))->add('name')->add('enabled', null, array('required' => false))->end(); $formMapper->setHelps(array('name' => $this->trans('help_dashboard_name'))); }
function configureFormFieldsAttributes(FormMapper $formMapper) { $formMapper->with('Attributes', array('class' => 'col-md-4'))->add('enabled', null, array('required' => false, 'label' => 'Show content on website'))->add('date', 'sonata_type_datetime_picker', ['required' => false, 'format' => 'dd.MM.yyyy H:mm', 'datepicker_use_button' => false])->end(); if ($this->subject && $this->subject->getRubric()) { $url = $this->configurationPool->getContainer()->get('iphp.core.entity.router')->entitySiteUrl($this->subject); $formMapper->setHelps(['enabled' => '<a target="_blank" href="' . $url . '">' . $url . '</a>']); } }
protected function configureFormFields(FormMapper $form) { $form->with('Page')->add('title')->add('content', 'ckeditor', ['config_name' => 'page'])->end(); if ($this->getSubject()) { $form->with('Route')->add('slug', null, ['required' => false])->end(); } $form->with('SEO')->add('seoMetaData', 'sonata_type_model_list', ['required' => false])->end(); $form->setHelps(['slug' => "If you leave empty it will be automatically created from the page title.<br/><br/> <b>Example:</b> <br/> <b>Title</b>: This article <br/> <b>Slug</b>: this-article"]); }
protected function configureFormFields(FormMapper $formMapper) { $formMapper->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('esPublico', null, array('label' => $this->getTranslator()->trans('es_publico')))->add('variables', null, array('label' => $this->getTranslator()->trans('variables'), 'expanded' => true))->add('formula', null, array('label' => $this->getTranslator()->trans('formula'), 'help' => $this->getTranslator()->trans('ayuda_ingreso_formula')))->add('clasificacionUso', null, array('label' => $this->getTranslator()->trans('clasificacion_uso-eTAB')))->add('clasificacionTecnica', null, array('label' => $this->getTranslator()->trans('clasificacion_tecnica'), '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))->add('meta', null, array('attr' => array('label' => $this->getTranslator()->trans('meta'), 'min' => '1')))->add('periodo', null, array('label' => $this->getTranslator()->trans('periodicidad')))->add('confiabilidad', null, array('label' => $this->getTranslator()->trans('confiabilidad'), 'required' => false))->add('observacion', 'textarea', array('label' => $this->getTranslator()->trans('_observacion_'), 'required' => false))->end()->with($this->getTranslator()->trans('alertas'))->add('alertas', 'sonata_type_collection', array('label' => $this->getTranslator()->trans('alertas'), 'required' => true), array('class' => 'form-control', 'edit' => 'inline', 'inline' => 'table', 'sortable' => 'position'))->end()->with($this->getTranslator()->trans('_dimensiones_'))->add('camposIndicador', null, array('label' => $this->getTranslator()->trans('campos_indicador')))->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 \Sonata\AdminBundle\Form\FormMapper $formMapper * @return void */ protected function configureFormFields(FormMapper $formMapper) { $templates = array(); foreach ($this->cmsManager->getPageManager()->getTemplates() as $code => $template) { $templates[$code] = $template->getName(); } if (!$this->getSubject() || !$this->getSubject()->isInternal()) { $formMapper->with($this->trans('form_page.group_main_label'))->add('url', 'text', array('attr' => array('readonly' => 'readonly')))->end(); } $formMapper->with($this->trans('form_page.group_main_label'))->add('name')->add('enabled', null, array('required' => false))->add('position')->add('templateCode', 'choice', array('required' => true, 'choices' => $templates))->add('parent', 'sonata_page_selector', array('page' => $this->getSubject() ?: null, 'model_manager' => $this->getModelManager(), 'class' => $this->getClass(), 'filter_choice' => array('hierarchy' => 'root'), 'required' => false))->end(); if (!$this->getSubject() || !$this->getSubject()->isDynamic()) { $formMapper->with($this->trans('form_page.group_main_label'))->add('target', 'sonata_page_selector', array('page' => $this->getSubject() ?: null, 'model_manager' => $this->getModelManager(), 'class' => $this->getClass(), 'filter_choice' => array('request_method' => 'all'), 'required' => false))->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('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'))); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { // get site and locales $site = null; $locales = array(); if ($this->getSubject()) { $site = $this->getSubject()->getSite(); foreach ($site->getLanguageVersions() as $lv) { $locales[] = $lv->getLocale(); } } // define group zoning $formMapper->with($this->trans('form_page.group_basic_label'), array('class' => 'col-md-6'))->end()->with($this->trans('form_page.group_settings_label'), array('class' => 'col-md-6'))->end()->with($this->trans('form_page.group_advanced_label'), array('class' => 'col-md-6'))->end(); if (!$this->getSubject() || !$this->getSubject()->isInternal() && !$this->getSubject()->isError()) { $formMapper->with($this->trans('form_page.group_basic_label'))->add('translations', 'orangegate_translations', array('label' => false, 'locales' => $locales, 'fields' => array('enabled' => array('field_type' => 'checkbox', 'required' => false), 'name' => array('field_type' => 'text', 'required' => false), 'description' => array('field_type' => 'textarea', 'required' => false), 'slug' => array('field_type' => 'text', 'required' => false), 'url' => array('field_type' => 'text', 'attr' => array('readonly' => 'readonly')), 'title' => array('field_type' => 'text', 'required' => false), 'metaKeyword' => array('field_type' => 'textarea', 'required' => false), 'metaDescription' => array('field_type' => 'textarea', 'required' => false))))->end(); } $formMapper->with($this->trans('form_page.group_settings_label'))->add('templateCode', 'sonata_page_template', array('required' => true))->add('parent', 'orangegate_page_selector', array('page' => $this->getSubject() ?: null, 'site' => $site, 'model_manager' => $this->getModelManager(), 'class' => $this->getClass(), 'required' => !$this->isGranted('EDIT')), array('admin_code' => $this->getCode(), 'link_parameters' => array('siteId' => $site->getId())))->add('icon', 'sonata_type_model_list', array('required' => false), array('placeholder' => 'No image selected', 'link_parameters' => array('context' => 'agrofert', 'provider' => 'sonata.media.provider.image', 'category' => 108, 'hide_context' => true)))->add('position')->add('cssClass')->end(); /* if ($this->hasSubject() && !$this->getSubject()->isInternal()) { $formMapper ->with($this->trans('form_page.group_settings_label')) ->add('type', 'sonata_page_type_choice', array('required' => false)) ->end() ; } if (!$this->getSubject() || !$this->getSubject()->isDynamic()) { $formMapper ->with($this->trans('form_page.group_settings_label')) ->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->hasSubject() && !$this->getSubject()->isCms()) { $formMapper->with($this->trans('form_page.group_advanced_label'), array('collapsed' => false))->add('decorate', null, array('required' => false))->end(); } $formMapper->with($this->trans('form_page.group_advanced_label'), array('collapsed' => false))->add('pageAlias', null, array('required' => false))->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'))); }
/** * {@inheritdoc} */ protected function configureFormFields(FormMapper $formMapper) { // define group zoning $formMapper->with('form_page.group_main_label', array('class' => 'col-md-6'))->end()->with('form_page.group_seo_label', array('class' => 'col-md-6'))->end()->with('form_page.group_advanced_label', array('class' => 'col-md-6'))->end(); if (!$this->getSubject() || !$this->getSubject()->isInternal() && !$this->getSubject()->isError()) { $formMapper->with('form_page.group_main_label')->add('url', 'text', array('attr' => array('readonly' => 'readonly')))->end(); } if ($this->hasSubject() && !$this->getSubject()->getId()) { $formMapper->with('form_page.group_main_label')->add('site', null, array('required' => true, 'read_only' => true))->end(); } $formMapper->with('form_page.group_main_label')->add('name')->add('enabled', null, array('required' => false))->add('position')->end(); if ($this->hasSubject() && !$this->getSubject()->isInternal()) { $formMapper->with('form_page.group_main_label')->add('type', 'sonata_page_type_choice', array('required' => false))->end(); } $formMapper->with('form_page.group_main_label')->add('templateCode', 'sonata_page_template', array('required' => true))->end(); if (!$this->getSubject() || $this->getSubject() && $this->getSubject()->getParent() || $this->getSubject() && !$this->getSubject()->getId()) { $formMapper->with('form_page.group_main_label')->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, 'filter_choice' => array('hierarchy' => 'root')), array('admin_code' => $this->getCode(), 'link_parameters' => array('siteId' => $this->getSubject() ? $this->getSubject()->getSite()->getId() : null)))->end(); } if (!$this->getSubject() || !$this->getSubject()->isDynamic()) { $formMapper->with('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('admin_code' => $this->getCode(), 'link_parameters' => array('siteId' => $this->getSubject() ? $this->getSubject()->getSite()->getId() : null)))->end(); } if (!$this->getSubject() || !$this->getSubject()->isHybrid()) { $formMapper->with('form_page.group_seo_label')->add('slug', 'text', array('required' => false))->add('customUrl', 'text', array('required' => false))->end(); } $formMapper->with('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('form_page.group_advanced_label', array('collapsed' => true))->add('decorate', null, array('required' => false))->end(); } $formMapper->with('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'))); }
/** * (non-PHPdoc). * * @see \Sonata\AdminBundle\Admin\Admin::configureFormFields() */ protected function configureFormFields(FormMapper $form) { if ($this->getSubject() == null || $this->getSubject()->getId() === null) { $form->add('path', 'text', array('mapped' => false)); } $form->add('alias', 'text'); $form->add('title', 'text'); $form->add('keywords', 'text'); $form->add('description', 'textarea', array()); $form->add('metatags', 'textarea', array('label' => 'additional metatags')); $form->setHelps(array('metatags' => 'help.metatags')); }
public function configureFormFields(FormMapper $formMapper) { $formMapper->with('General')->add('slug', null, array('required' => false))->add('title')->add('content', $this->contentType)->add('published', null, array('required' => false))->end()->with('SEO')->add('metaKeywords', null, array('required' => false))->add('metaDescription', null, array('required' => false))->end(); $formMapper->setHelps(array('slug' => 'Leave blank for automatic filling from title field')); }