* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ declare(strict_types=1); namespace PrestaShopBundle\Form\Admin\Extension; use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Component\Form\Extension\Core\Type\FormType; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\OptionsResolver; /** * Class HintTextExtension extends every form type with additional hint text options. */ class HintTextExtension extends AbstractTypeExtension { /** * {@inheritdoc} */ public function configureOptions(OptionsResolver $resolver) { $resolver ->setDefaults([ 'hint' => null, ]) ->setAllowedTypes('hint', ['null', 'string']) ; } /** * {@inheritdoc} */ public function buildView(FormView $view, FormInterface $form, array $options) { $view->vars['hint'] = isset($options['hint']) ? $options['hint'] : null; } /** * {@inheritdoc} */ public static function getExtendedTypes(): iterable { return [FormType::class]; } }