All pastes #2108934 Raw Edit

Miscellany

public text v1 · immutable
#2108934 ·published 2012-02-02 06:02 UTC
rendered paste body
<?php

namespace Politistream\CoreBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\ClassLoader\UniversalClassLoader;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Politistream\CoreBundle\Entity\BasicInformationProfileComponent;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;

class ProfileConfigurationType extends AbstractType
{

  public function buildForm(FormBuilder $builder, array $options)
  {
    // TODO: These should be loaded dynamically from the config
    $components = array(
        'basic' => 'Basic Profile Information'
    );

    $blocks = array(
        'default' => 'Default'
    );

    $builder->add('component', 'choice', array('choices' => $components, 'required' => false));
    $builder->add('block', 'choice', array('choices' => $blocks, 'required' => false));
  }

  public function getName()
  {
    return 'profile_configuration';
  }

  public function getDefaultOptions(array $options)
  {
    $options = parent::getDefaultOptions($options);
    $options['data_class'] = 'Politistream\CoreBundle\Component\Profile\ProfileConfiguration';
    return $options;
  }

}