public function buildForm(FormBuilderInterface $builder, array $options) { parent::buildForm($builder, $options); /* $a = explode(' ', $this->lcScope); $a = array_combine($a, $a); $builder->add('allowedScopes', 'collection', array( 'type' => 'choice', 'options' => array( 'choices' => $a ), 'required' => true, 'allow_add' => true )); $builder->add('allowedGrantTypes', 'collection', array( 'type' => 'choice', 'options' => array( 'choices' => array( OAuth2::GRANT_TYPE_AUTH_CODE => 'authorization_code', OAuth2::GRANT_TYPE_IMPLICIT => 'token', OAuth2::GRANT_TYPE_USER_CREDENTIALS => 'password', OAuth2::GRANT_TYPE_CLIENT_CREDENTIALS => 'client_credentials', OAuth2::GRANT_TYPE_REFRESH_TOKEN => 'refresh_token', OAuth2::GRANT_TYPE_EXTENSIONS => 'extensions' ), 'preferred_choices' => array( OAuth2::GRANT_TYPE_AUTH_CODE ) ), 'required' => true, 'allow_add' => true )); */ }
public function buildForm(FormBuilderInterface $builder, array $options) { parent::buildForm($builder, $options); $security = $this->security; $public = array_combine($this->publicScopes, $this->publicScopes); $reserved = array_combine($this->reservedScopes, $this->reservedScopes); $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use($security, $public, $reserved) { $form = $event->getForm(); if ($security->isGranted('ROLE_EDIT_CLIENT_ALLOWED_SCOPES')) { $form->add('allowedScopes', 'choice', array('choices' => array('Public Scopes' => $public, 'Restricted Scopes' => $reserved), 'multiple' => true, 'choices_as_values' => false)); } }); }
public function buildForm(FormBuilderInterface $builder, array $options) { parent::buildForm($builder, $options); }