Files
kimai2/src/TimesheetBundle/Form/ActivityEditForm.php
Kevin Papst 79e87ecdbe added toolbar to customer screen #28 (#49)
* fixed filter query #28
* fixed annotation #28
* merge message files #28
* added page size type #28
* added visibility type #28
* added filter toolbar to customer screen #28
2018-01-07 21:42:27 +01:00

70 lines
1.8 KiB
PHP

<?php
/*
* This file is part of the Kimai package.
*
* (c) Kevin Papst <kevin@kevinpapst.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace TimesheetBundle\Form;
use AppBundle\Form\Type\VisibilityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use TimesheetBundle\Entity\Activity;
use TimesheetBundle\Form\Type\ProjectType;
/**
* Defines the form used to manipulate Activities.
*
* @author Kevin Papst <kevin@kevinpapst.de>
*/
class ActivityEditForm extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
// string - length 255
->add('name', TextType::class, [
'label' => 'label.name',
])
// text
->add('comment', TextareaType::class, [
'label' => 'label.comment',
'required' => false,
])
// entity type: project
->add('project', ProjectType::class, [
'label' => 'label.project',
])
// boolean
->add('visible', VisibilityType::class, [
'label' => 'label.visible',
])
;
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Activity::class,
'csrf_protection' => true,
'csrf_field_name' => '_token',
'csrf_token_id' => 'admin_activity_edit',
]);
}
}