Skip to content

Commit

Permalink
Add support for Hidden fields
Browse files Browse the repository at this point in the history
  • Loading branch information
edhgoose committed Dec 4, 2019
1 parent e12ee3d commit 5509310
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "limenius/liform",
"description": "Library to transform Symfony Forms into Json Schema",
"name": "mention-me/liform",
"description": "Library to transform Symfony Forms into Json Schema. Extends Limenius/liform.",
"type": "library",
"license": "MIT",
"authors": [
Expand Down
22 changes: 22 additions & 0 deletions src/Limenius/Liform/Transformer/HiddenTransformer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Limenius\Liform\Transformer;

use Symfony\Component\Form\FormInterface;

class HiddenTransformer extends AbstractTransformer
{
/**
* Given that this transformation will only be called when the type is a hidden, it allows us to define how to build
* the schema.
*
* {@inheritdoc}
*/
public function transform(FormInterface $form, array $extensions = [], $widget = null)
{
$schema = ['type' => 'string'];
$schema = $this->addCommonSpecs($form, $schema, $extensions, $widget);

return $schema;
}
}

0 comments on commit 5509310

Please sign in to comment.