本文整理汇总了PHP中Sonata\AdminBundle\Form\FormMapper::with方法的典型用法代码示例。如果您正苦于以下问题:PHP FormMapper::with方法的具体用法?PHP FormMapper::with怎么用?PHP FormMapper::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\AdminBundle\Form\FormMapper
的用法示例。
在下文中一共展示了FormMapper::with方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->with('form.group_general', array('translation_domain' => 'CmfRoutingBundle'))->add('parent', Sf2CompatUtil::getFormTypeName('doctrine_phpcr_odm_tree'), array('choice_list' => array(), 'select_root_node' => true, 'root_node' => $this->routeRoot))->add('name', Sf2CompatUtil::getFormTypeName('text'))->end();
if (null === $this->getParentFieldDescription()) {
$formMapper->with('form.group_general', array('translation_domain' => 'CmfRoutingBundle'))->add('content', Sf2CompatUtil::getFormTypeName('doctrine_phpcr_odm_tree'), array('choice_list' => array(), 'required' => false, 'root_node' => $this->contentRoot))->end()->with('form.group_advanced', array('translation_domain' => 'CmfRoutingBundle'))->add('variablePattern', Sf2CompatUtil::getFormTypeName('text'), array('required' => false), array('help' => 'form.help_variable_pattern'))->add('defaults', Sf2CompatUtil::getFormTypeName('sonata_type_immutable_array'), array('keys' => $this->configureFieldsForDefaults($this->getSubject()->getDefaults())))->add('options', Sf2CompatUtil::getFormTypeName('sonata_type_immutable_array'), array('keys' => $this->configureFieldsForOptions($this->getSubject()->getOptions())), array('help' => 'form.help_options'))->end()->end();
}
}
示例2: configureFormFields
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();
}
}
示例3: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
if ($this->hasProvider()) {
$tabSettings = array('class' => 'col-md-4');
} else {
$tabSettings = array('class' => 'col-md-8');
}
$formMapper->with('tab.group.bruery_classification_tag_general', $tabSettings)->end();
if ($this->hasProvider()) {
$formMapper->with('tab.group.bruery_classification_tag_settings', array('class' => 'col-md-8'))->end();
}
$formMapper->with('tab.group.bruery_classification_tag_general')->add('name')->end();
if ($this->hasSubject() && $this->getSubject()->getId()) {
$formMapper->with('tab.group.bruery_classification_tag_general')->add('slug')->end();
}
$formMapper->with('tab.group.bruery_classification_tag_general')->add('enabled', null, array('required' => false))->end();
if ($this->hasProvider()) {
$instance = $this->getSubject();
if ($instance && $instance->getId()) {
$this->provider->load($instance);
$this->provider->buildEditForm($formMapper);
} else {
$this->provider->buildCreateForm($formMapper);
}
}
}
示例4: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->with('General')->add('username')->add('email')->add('plainPassword', 'text', array('required' => false))->end();
if (!$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
$formMapper->with('Management')->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();
}
}
示例5: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->with('tab_user', array('class' => 'col-md-8'))->add('username', 'text')->add('email', 'email')->add('licence', 'text', array('required' => false))->add('plainPassword', 'text', array('required' => !$this->getSubject() || is_null($this->getSubject()->getId())))->end()->with('tab_status', array('class' => 'col-md-4'))->add('enabled', 'checkbox', array('required' => false))->add('locked', 'checkbox', array('required' => false))->add('expired', 'checkbox', array('required' => false))->add('credentialsExpired', 'checkbox', array('required' => false))->end()->with('tab_roles', array('class' => 'col-md-12'))->add('roles', 'user_admin_roles')->end();
if ($this->isGranted('ROLE_SUPER_ADMIN')) {
$formMapper->with('tab_status')->add('newsletter', 'checkbox', array('required' => false))->end();
}
}
示例6: configureFormFields
/**
* {@inheritdoc}
*/
public function configureFormFields(FormMapper $formMapper)
{
if (!$this->isChild()) {
$formMapper->with($this->trans('order.form.group_main_label', array(), 'SonataOrderBundle'))->add('customer', 'sonata_type_model_list')->end();
}
$formMapper->with($this->trans('order.form.group_main_label', array(), 'SonataOrderBundle'))->add('currency', 'sonata_currency')->add('locale', 'locale')->add('status', 'sonata_order_status', array('translation_domain' => 'SonataOrderBundle'))->add('paymentStatus', 'sonata_payment_transaction_status', array('translation_domain' => 'SonataPaymentBundle'))->add('deliveryStatus', 'sonata_product_delivery_status', array('translation_domain' => 'SonataDeliveryBundle'))->add('validatedAt')->end()->with($this->trans('order.form.group_billing_label', array(), 'SonataOrderBundle'), array('collapsed' => true))->add('billingName')->add('billingAddress1')->add('billingAddress2')->add('billingAddress3')->add('billingCity')->add('billingPostcode')->add('billingCountryCode', 'country')->add('billingFax')->add('billingEmail')->add('billingMobile')->end()->with($this->trans('order.form.group_shipping_label', array(), 'SonataOrderBundle'), array('collapsed' => true))->add('shippingName')->add('shippingAddress1')->add('shippingAddress2')->add('shippingAddress3')->add('shippingCity')->add('shippingPostcode')->add('shippingCountryCode', 'country')->add('shippingFax')->add('shippingEmail')->add('shippingMobile')->end();
}
示例7: configureFormFields
/**
* @param \Sonata\AdminBundle\Form\FormMapper $formMapper
*
* @return void
*/
protected function configureFormFields(FormMapper $formMapper)
{
$rubric = $this->getSubject();
$formMapper->with('Rubric', array('class' => 'col-md-8'))->end();
$formMapper->with('Attributes', array('class' => 'col-md-4'))->end();
$this->addInformationBlock($formMapper);
$formMapper->with('Rubric');
$formMapper->add('title');
if (!$rubric->isRoot()) {
$formMapper->add('parent', 'rubricchoice', array('label' => 'Parent Rubric'))->add('path', 'slug_text', array('source_field' => 'title', 'usesource_title' => $this->trans('Use rubric title')))->setHelps(array('path' => 'Path used for building rubric url'));
}
$formMapper->add('abstract')->add('redirectUrl')->add('controllerName', 'modulechoice', array('label' => 'Choose module', 'required' => false, 'empty_value' => ' '));
$formMapper->end();
$formMapper->with('Attributes');
$this->addMenuRelatedFields($rubric, $formMapper);
if ($rubric->getModuleError()) {
$formMapper->add('moduleError', 'genemu_plain', array('attr' => array('style' => 'color:red')));
}
$formMapper->end();
if ($this->subject && $this->subject->getId()) {
$url = $this->configurationPool->getContainer()->get('iphp.core.entity.router')->entitySiteUrl($this->subject);
$formMapper->setHelps(['status' => '<a target="_blank" href="' . $url . '">' . $url . '</a>']);
}
$this->configureModuleFormFields($rubric, $formMapper);
}
示例8: configureFormFields
/**
* {@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();
}
}
示例9: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->with('General')->add('username')->add('email')->add('plainPassword', 'text', array('required' => false))->end();
if (!$this->getSubject()->hasRole('ROLE_SUPER_ADMIN')) {
$formMapper->with('Management')->add('roles', 'choice', array('expanded' => false, 'multiple' => true, 'required' => false, 'choices' => $this->getConfigurationPool()->getContainer()->get("bde.main.roles_provider")->getRoles()))->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();
}
}
示例10: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->with('General', array('class' => 'col-md-6'))->add('name')->add('description', 'textarea', array('required' => false))->end()->with('Options', array('class' => 'col-md-6'))->add('position', 'integer', array('required' => false, 'data' => 0))->add('parent', 'sonata_category_selector', array('category' => $this->getSubject() ?: null, 'model_manager' => $this->getModelManager(), 'class' => $this->getClass(), 'required' => false))->end();
if (interface_exists('Sonata\\MediaBundle\\Model\\MediaInterface')) {
$formMapper->with('General')->add('media', 'sonata_type_model_list', array('required' => false), array('link_parameters' => array('provider' => 'sonata.media.provider.image', 'context' => 'sonata_category')))->end();
}
}
示例11: configureFormFields
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();
}
}
示例12: configureFormFields
/**
* {@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')));
}
示例13: configureFormFields
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->with('form.group_general')->add('parent', 'doctrine_phpcr_odm_tree', array('choice_list' => array(), 'select_root_node' => true, 'root_node' => $this->routeRoot))->add('name', 'text')->end();
if (null === $this->getParentFieldDescription()) {
$formMapper->with('form.group_general')->add('variablePattern', 'text', array('required' => false))->add('routeContent', 'doctrine_phpcr_odm_tree', array('choice_list' => array(), 'required' => false, 'root_node' => $this->contentRoot))->add('defaults', 'sonata_type_immutable_array', array('keys' => $this->configureFieldsForDefaults()))->end();
}
}
示例14: configureFormFields
/**
* {@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();
}
示例15: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$provider = $this->getPoolProvider($this->pool);
if ($provider) {
$tabSettings = array('class' => 'col-md-4');
} else {
$tabSettings = array('class' => 'col-md-8');
}
$formMapper->with('tab.group.bruery_classification_collection_general', $tabSettings)->end();
if ($provider) {
$formMapper->with('tab.group.bruery_classification_collection_settings', array('class' => 'col-md-8'))->end();
}
$formMapper->with('tab.group.bruery_classification_collection_general')->add('name')->add('description', 'textarea', array('required' => false, 'attr' => array('rows' => 8)))->add('enabled', null, array('required' => false))->end();
if (interface_exists('Sonata\\MediaBundle\\Model\\MediaInterface')) {
$formMapper->with('tab.group.bruery_classification_collection_general')->add('media', 'sonata_type_model_list', array('required' => false), array('link_parameters' => array('provider' => 'sonata.media.provider.image', 'context' => 'sonata_collection')))->end();
}
if ($provider) {
$instance = $this->getSubject();
if ($instance && $instance->getId()) {
$provider->load($instance);
$provider->buildEditForm($formMapper);
} else {
$provider->buildCreateForm($formMapper);
}
}
}