2018-02-19 10:56:51 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This file is part of the NelmioApiDocBundle package.
|
|
|
|
*
|
|
|
|
* (c) Nelmio
|
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Nelmio\ApiDocBundle\Form\Extension;
|
|
|
|
|
|
|
|
use Symfony\Component\Form\AbstractTypeExtension;
|
|
|
|
use Symfony\Component\Form\Extension\Core\Type\FormType;
|
|
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Aaron Scherer <aequasi@gmail.com>
|
|
|
|
*/
|
|
|
|
class DocumentationExtension extends AbstractTypeExtension
|
|
|
|
{
|
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
|
|
{
|
|
|
|
$builder->setAttribute('documentation', $options['documentation']);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function configureOptions(OptionsResolver $resolver)
|
|
|
|
{
|
|
|
|
$resolver->setDefaults(['documentation' => []])
|
2020-12-02 15:38:38 +01:00
|
|
|
->setAllowedTypes('documentation', ['array', 'bool']);
|
2018-02-19 10:56:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getExtendedType()
|
|
|
|
{
|
2019-01-25 20:25:46 +03:00
|
|
|
return self::getExtendedTypes()[0];
|
|
|
|
}
|
|
|
|
|
2019-11-22 14:07:00 +01:00
|
|
|
public static function getExtendedTypes(): iterable
|
2019-01-25 20:25:46 +03:00
|
|
|
{
|
|
|
|
return [FormType::class];
|
2018-02-19 10:56:51 +01:00
|
|
|
}
|
|
|
|
}
|