Added basic book adding functionality
Signed-off-by: Gergely POLONKAI <polesz@w00d5t0ck.info>master
parent
acea821bdb
commit
ebb0469ae1
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace KekRozsak\FrontBundle\Form\Type;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
|
||||
|
||||
class BookType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add(
|
||||
'author',
|
||||
null,
|
||||
array(
|
||||
'label' => 'Szerző',
|
||||
)
|
||||
)
|
||||
->add(
|
||||
'title',
|
||||
null,
|
||||
array(
|
||||
'label' => 'Cím',
|
||||
)
|
||||
)
|
||||
->add(
|
||||
'year',
|
||||
null,
|
||||
array(
|
||||
'label' => 'Kiadás éve',
|
||||
)
|
||||
)
|
||||
->add(
|
||||
'commentable',
|
||||
null,
|
||||
array(
|
||||
'label' => 'Kommentelhető?',
|
||||
'required' => false
|
||||
)
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
public function setDefaultOptions(OptionsResolverInterface $resolver)
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'data_class' => 'KekRozsak\FrontBundle\Entity\Book'
|
||||
));
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'kekrozsak_frontbundle_booktype';
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{% form_theme form 'KekRozsakFrontBundle:Form:user_form.html.twig' %}
|
||||
<div id="new-book-form-result">
|
||||
<form method="POST" action="{{ path('KekRozsakFrontBundle_bookNew') }}" id="new-book-form">
|
||||
<table>
|
||||
{{ form_widget(form) }}
|
||||
</table>
|
||||
<button id="new-book-save-button" type="submit">Mentés</button>
|
||||
</form>
|
||||
</div>
|
@ -1,2 +1,4 @@
|
||||
*
|
||||
!.git*
|
||||
!jquery-cluetip
|
||||
!jquery-form
|
||||
|
Loading…
Reference in New Issue