-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dynamic field type Hidden (#362)
- Loading branch information
1 parent
b3c3bd4
commit ed1520a
Showing
7 changed files
with
82 additions
and
4 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,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Sulu. | ||
* | ||
* (c) Sulu GmbH | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Sulu\Bundle\FormBundle\Dynamic\Types; | ||
|
||
use Sulu\Bundle\FormBundle\Dynamic\FormFieldTypeConfiguration; | ||
use Sulu\Bundle\FormBundle\Dynamic\FormFieldTypeInterface; | ||
use Sulu\Bundle\FormBundle\Entity\FormField; | ||
use Symfony\Component\Form\Extension\Core\Type\HiddenType as TypeHiddenType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
/** | ||
* The Hidden form field type. | ||
*/ | ||
class HiddenType implements FormFieldTypeInterface | ||
{ | ||
use SimpleTypeTrait; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfiguration(): FormFieldTypeConfiguration | ||
{ | ||
return new FormFieldTypeConfiguration( | ||
'sulu_form.type.hidden', | ||
__DIR__ . '/../../Resources/config/form-fields/field_hidden.xml' | ||
); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build(FormBuilderInterface $builder, FormField $field, string $locale, array $options): void | ||
{ | ||
$type = TypeHiddenType::class; | ||
$builder->add($field->getKey(), $type, $options); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -38,6 +38,7 @@ class Dynamic implements AuditableInterface | |
'headline', | ||
'freeText', | ||
'recaptcha', | ||
'hidden', | ||
]; | ||
|
||
/** | ||
|
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,23 @@ | ||
<?xml version="1.0" ?> | ||
<properties xmlns="http://schemas.sulu.io/template/template" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://schemas.sulu.io/template/template http://schemas.sulu.io/template/properties-1.0.xsd"> | ||
<property name="title" type="text_editor" mandatory="true"> | ||
<meta> | ||
<title>sulu_form.title</title> | ||
</meta> | ||
</property> | ||
|
||
<property name="shortTitle" type="text_line" colspan="6"> | ||
<meta> | ||
<title>sulu_form.short_title</title> | ||
<info_text>sulu_form.short_title_description</info_text> | ||
</meta> | ||
</property> | ||
|
||
<property name="defaultValue" type="text_line" colspan="6"> | ||
<meta> | ||
<title>sulu_form.default</title> | ||
</meta> | ||
</property> | ||
</properties> |
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