cethyworks / time-select
This package is abandoned and no longer maintained.
No replacement package was suggested.
Provides a SelectType containing a selection of possible time values, from 00:00 to 23:45.
v0.3
2018-02-06 17:13 UTC
Requires
- php: >=5.6.17
- symfony/form: ^3.3
- symfony/options-resolver: ^3.3
Requires (Dev)
- phpunit/phpunit: ^4.8
This package is not auto-updated.
Last update: 2024-11-17 08:33:11 UTC
README
Provides a SelectType containing a selection of possible time values, from 00:00
to 23:45
(with a default 15 minutes step).
How to use
namespace ExampleBundle\Form;
use Cethyworks\TimeSelect\Form\TimeSelectType;
class ExampleType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('exampleTime', TimeSelectType::class)
// ...
;
}
// ...
}
Options
Change the input' starting value
Overrides the choices array :
// ...
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('exampleTime', TimeSelectType::class, [
'choices' => TimeSelectType::generateChoices(8, 45, 5, 2),
)
// ...
;
}
// ...
In this example, the input will start at 8:45 (and end at 8:30), with a 5 minutes step and a 2 hours step.