-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #908 from heiglandreas/addMultipleHosts
Provide UI to manage hosts of an event.
- Loading branch information
Showing
7 changed files
with
369 additions
and
10 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
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
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
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,71 @@ | ||
<?php | ||
|
||
namespace Event; | ||
|
||
use Form\Constraint\UrlResolverConstraint; | ||
use Form\DataTransformer\DateTransformer; | ||
use Form\DataTransformer\EventTagsTransformer; | ||
use Form\Listener\GetResolvedUrlListener; | ||
use Symfony\Component\Form\AbstractType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
use Symfony\Component\Validator\Constraints as Assert; | ||
|
||
/** | ||
* Form used to render and validate the submission of a new event. | ||
* | ||
* Usage (extraneous use of variables is made to illustrate which parts are used): | ||
* | ||
* ``` | ||
* $formType = new EventFormType(); | ||
* $factory = $this->application->formFactory; | ||
* $form = $factory->create($formType); | ||
* $formName = $form->getName(); | ||
* | ||
* if ($this->application->request()->isPost()) { | ||
* $data = $request->post($formName); | ||
* | ||
* $form->submit($data); | ||
* | ||
* if ($form->isValid()) { | ||
* // ... perform success actions | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
class EventHostFormType extends AbstractType | ||
{ | ||
/** | ||
* Returns the name of this form type. | ||
* | ||
* @return string | ||
*/ | ||
public function getName() | ||
{ | ||
return 'eventhost'; | ||
} | ||
|
||
/** | ||
* Adds fields with their types and validation constraints to this definition. | ||
* | ||
* This method is automatically called by the Form Factory builder and does not need | ||
* to be called manually, see the class description for usage information. | ||
* | ||
* @param FormBuilderInterface $builder | ||
* @param array $options | ||
* | ||
* @return void | ||
*/ | ||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
$builder | ||
->add( | ||
'host', | ||
'text', | ||
[ | ||
'label' => 'Add additional host', | ||
'constraints' => [new Assert\NotBlank(), new Assert\Length(['min' => 2])], | ||
] | ||
) | ||
; | ||
} | ||
} |
Oops, something went wrong.