cethyworks / time-select
提供包含从00:00到23:45可能时间值的SelectType。
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-09-22 07:41:39 UTC
README
提供包含从00:00
到23:45
可能时间值的SelectType(默认15分钟步长)。
如何使用
namespace ExampleBundle\Form;
use Cethyworks\TimeSelect\Form\TimeSelectType;
class ExampleType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('exampleTime', TimeSelectType::class)
// ...
;
}
// ...
}
选项
更改输入的起始值
覆盖选择数组
// ...
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('exampleTime', TimeSelectType::class, [
'choices' => TimeSelectType::generateChoices(8, 45, 5, 2),
)
// ...
;
}
// ...
在这个例子中,输入将从8:45开始(并结束于8:30),步长为5分钟和2小时。