Release 2.7.0 (#4506)
* added api URL for simpler integration * allow to request password change upon next login * make ModifiedAt timesheet independent * improved plugin api * replace kernel calls with AutoconfigureTag and TaggedIterator attributes * new translation keys (e.g. for days) * support setting min and max date on date and daterange pickers
This commit is contained in:
@@ -15,6 +15,8 @@ use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\CallbackTransformer;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
@@ -50,6 +52,20 @@ class DatePickerType extends AbstractType
|
||||
));
|
||||
}
|
||||
|
||||
public function buildView(FormView $view, FormInterface $form, array $options): void
|
||||
{
|
||||
if ($options['min_day'] !== null) {
|
||||
$view->vars['attr'] = array_merge($view->vars['attr'], [
|
||||
'min' => $options['min_day'],
|
||||
]);
|
||||
}
|
||||
if ($options['max_day'] !== null) {
|
||||
$view->vars['attr'] = array_merge($view->vars['attr'], [
|
||||
'max' => $options['max_day'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$format = $this->localeService->getDateFormat(\Locale::getDefault());
|
||||
@@ -64,6 +80,8 @@ class DatePickerType extends AbstractType
|
||||
'model_timezone' => date_default_timezone_get(),
|
||||
'view_timezone' => date_default_timezone_get(),
|
||||
'force_time' => null,
|
||||
'min_day' => null,
|
||||
'max_day' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ final class DateRangeType extends AbstractType
|
||||
'separator' => self::DATE_SPACER,
|
||||
'allow_empty' => true,
|
||||
'with_presets' => true,
|
||||
'min_day' => null,
|
||||
'max_day' => null,
|
||||
'attr' => [
|
||||
'pattern' => $pattern . self::DATE_SPACER . $pattern
|
||||
],
|
||||
@@ -87,6 +89,18 @@ final class DateRangeType extends AbstractType
|
||||
$view->vars['attr'] = array_merge($view->vars['attr'], [
|
||||
'data-separator' => $options['separator'],
|
||||
]);
|
||||
|
||||
if ($options['min_day'] !== null) {
|
||||
$view->vars['attr'] = array_merge($view->vars['attr'], [
|
||||
'min' => $options['min_day'],
|
||||
]);
|
||||
}
|
||||
|
||||
if ($options['max_day'] !== null) {
|
||||
$view->vars['attr'] = array_merge($view->vars['attr'], [
|
||||
'max' => $options['max_day'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
|
||||
Reference in New Issue
Block a user