Advertisement
ascott

Form\Type\FormConfigurations.php

Oct 16th, 2012
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.93 KB | None | 0 0
  1. <?php
  2. namespace Lynux\CoreBundle\Form\Type\Configurations;
  3.  
  4. use Doctrine\ORM\EntityRepository;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\OptionsResolver\OptionsResolverInterface;
  8.  
  9. class FormConfigurations extends AbstractType
  10. {
  11.     /*
  12.     protected $features;
  13.  
  14.     public function __construct($features)
  15.     {
  16.         $this->features = $features;
  17.     }
  18.     */
  19.  
  20.     public function buildForm(FormBuilderInterface $builder, array $options)
  21.     {
  22.  
  23.         $builder->add(
  24.             'name',
  25.             'text',
  26.             array(
  27.                 'label' => 'Configuration Name',));
  28.         $builder->add(
  29.             'domain',
  30.             'text',
  31.             array(
  32.                 'label' => 'Full Domain Name',));
  33.         $builder->add(
  34.             'theme',
  35.             'choice',
  36.             array(
  37.                 'label'   => 'Theme',
  38.                 'choices' => array(
  39.                     'theme_wide'  => 'Default Theme',
  40.                     'theme_blue'  => 'Light Blue Theme',
  41.                     'theme_green' => 'Green Theme'),));
  42.         $builder->add(
  43.             'layout',
  44.             'choice',
  45.             array(
  46.                 'label'   => 'Default Layout',
  47.                 'choices' => array(
  48.                     '1' => '1 Column',
  49.                     '2' => '2 Column',
  50.                     '3' => '3 Column'),));
  51.         $builder->add(
  52.             'titleWebsite',
  53.             'text',
  54.             array(
  55.                 'label' => 'Website Title',));
  56.         $builder->add(
  57.             'titleBrowser',
  58.             'text',
  59.             array(
  60.                 'label' => 'Browser Title',));
  61.         $builder->add(
  62.             'webadmin',
  63.             'text',
  64.             array(
  65.                 'label' => 'WebAdmin Name',));
  66.         $builder->add(
  67.             'webadminEmail',
  68.             'email',
  69.             array(
  70.                 'label' => 'WebAdmin Email',));
  71.         $builder->add(
  72.             'features',
  73.             'entity',
  74.                 array(
  75.                     'class'         => 'LynuxAssetBundle:Core\Codes',
  76.                     'property_path' => false,
  77.                     'query_builder' => function(EntityRepository $er)
  78.                         {
  79.                             return $er->createQueryBuilder('u')
  80.                                 ->where('u.submodule = :submodule')
  81.                                 ->setParameter('submodule', 'feature');
  82.                         },
  83.                     'expanded' => true,
  84.                     'multiple' => true,
  85.                     'property' => 'title',));
  86.     }
  87.  
  88.     public function getName()
  89.     {
  90.         return 'FormConfigurations';
  91.     }
  92.  
  93.     public function setDefaultOptions(OptionsResolverInterface $resolver)
  94.     {
  95.         $resolver->setDefaults(
  96.             array('data_class' => 'Lynux\AssetBundle\Entity\Core\Configurations',)
  97.         );
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement