code cleanup
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Form\Type;
|
||||
|
||||
use App\Utils\MomentFormatConverter;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\DateTimeType;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* Defines the custom form field type used to manipulate datetime values across
|
||||
* Bootstrap Date\Time Picker javascript plugin.
|
||||
* See http://symfony.com/doc/current/cookbook/form/create_custom_field_type.html
|
||||
*
|
||||
* @author Yonel Ceruto <yonelceruto@gmail.com>
|
||||
*/
|
||||
class DateTimePickerType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @var MomentFormatConverter
|
||||
*/
|
||||
private $formatConverter;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->formatConverter = new MomentFormatConverter();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$view->vars['attr']['data-date-format'] = $this->formatConverter->convert($options['format']);
|
||||
$view->vars['attr']['data-date-locale'] = \Locale::getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'widget' => 'single_text',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return DateTimeType::class;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,8 @@ class LanguageType extends AbstractType
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'choices' => array(
|
||||
Intl::getLocaleBundle()->getLocaleName('de', 'de') => 'de'
|
||||
Intl::getLocaleBundle()->getLocaleName('de', \Locale::getDefault()) => 'de',
|
||||
Intl::getLocaleBundle()->getLocaleName('en', \Locale::getDefault()) => 'en',
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class UserType extends AbstractType
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'class' => 'Kimai:User',
|
||||
'class' => User::class,
|
||||
'choice_label' => function (User $user) {
|
||||
if (!empty($user->getAlias())) {
|
||||
return $user->getAlias() . ' (' . $user->getUsername() . ')';
|
||||
|
||||
Reference in New Issue
Block a user