-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Symfony 3 #36
Changes from 11 commits
492d3cf
1fbea2d
f9c5ca3
42ffbff
8d5aa97
fd956d2
8abb20e
0d9f386
e324861
b21b75e
41623d1
c3ec313
5d9c93d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the SCDatetimepickerBundle package. | ||
* This file is part of the DatetimepickerBundle package. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks wrong to me |
||
* | ||
* (c) Stephane Collot | ||
* | ||
|
@@ -46,7 +46,7 @@ class DatetimeType extends AbstractType | |
* | ||
* @param array $options | ||
*/ | ||
public function __construct(array $options) | ||
public function __construct(array $options = array()) | ||
{ | ||
$this->options = $options; | ||
|
||
|
@@ -164,7 +164,7 @@ public function getParent() | |
|
||
public function getName() | ||
{ | ||
return 'collot_datetime'; | ||
return $this->getBlockPrefix(); | ||
} | ||
|
||
public function getBlockPrefix() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ public function registerBundles() | |
{ | ||
$bundles = array( | ||
// ... | ||
new SC\DatetimepickerBundle\SCDatetimepickerBundle(), | ||
new SC\DatetimepickerBundle\DatetimepickerBundle(), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be referted too |
||
); | ||
} | ||
``` | ||
|
@@ -59,14 +59,16 @@ $ php app/console assets:install web/ | |
``` php | ||
<?php | ||
// ... | ||
use SC\DatetimepickerBundle\Form\Type\DatetimeType; | ||
|
||
public function buildForm(FormBuilder $builder, array $options) | ||
{ | ||
$builder | ||
// defaut options | ||
->add('createdAt', 'collot_datetime') | ||
->add('createdAt', DatetimeType::class) | ||
|
||
// full options | ||
->add('updatedAt', 'collot_datetime', array( 'pickerOptions' => | ||
->add('updatedAt', DatetimeType::class, array( 'pickerOptions' => | ||
array('format' => 'mm/dd/yyyy', | ||
'weekStart' => 0, | ||
'startDate' => date('m/d/Y'), //example | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{% block form_stylesheet %} | ||
{% spaceless %} | ||
{% for child in form %} | ||
{{ form_stylesheet(child) }} | ||
{% if child.vars.pickerOptions is defined %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The option should never be undefined. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. covers all fields, the other fields do not have the option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I mean is that with this change the needed CSS files will never be loaded in case the form type provided by this bundle is nested in the form type tree as the block doesn't descend the structure. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand, I look |
||
{{ form_stylesheet(child) }} | ||
{% endif %} | ||
{% endfor %} | ||
{% endspaceless %} | ||
{% endblock form_stylesheet %} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still run builds with older still supported PHP versions to be sure to not introduce any regressions.