-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added new
DataListTextType
to render HTML input with their da…
…talist.
- Loading branch information
1 parent
eea6399
commit 5316137
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RZ\Roadiz\CoreBundle\Form; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\Extension\Core\Type\TextType; | ||
use Symfony\Component\Form\FormInterface; | ||
use Symfony\Component\Form\FormView; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
class DataListTextType extends AbstractType | ||
{ | ||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
parent::configureOptions($resolver); | ||
|
||
$resolver->setRequired('listName'); | ||
$resolver->setAllowedTypes('listName', 'string'); | ||
$resolver->setRequired('list'); | ||
$resolver->setAllowedTypes('list', 'array'); | ||
} | ||
|
||
public function buildView(FormView $view, FormInterface $form, array $options): void | ||
{ | ||
parent::buildView($view, $form, $options); | ||
|
||
$view->vars['listName'] = $options['listName']; | ||
$view->vars['list'] = $options['list']; | ||
} | ||
|
||
|
||
public function getBlockPrefix(): string | ||
{ | ||
return 'data_list_text'; | ||
} | ||
|
||
public function getParent(): string | ||
{ | ||
return TextType::class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters