mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch '2.6' into 2.7
This commit is contained in:
commit
345d8d8390
2 changed files with 57 additions and 0 deletions
|
@ -7430,6 +7430,53 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$this->assertNotContains('value="' . date('d') . '" selected="selected"', $result);
|
$this->assertNotContains('value="' . date('d') . '" selected="selected"', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testInputDate method
|
||||||
|
*
|
||||||
|
* Test various inputs with type date and different option attributes.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testInputDateOptions() {
|
||||||
|
$this->Form->create('User');
|
||||||
|
|
||||||
|
$result = $this->Form->input('date',
|
||||||
|
array(
|
||||||
|
'label' => false,
|
||||||
|
'type' => 'day',
|
||||||
|
'class' => 'form-control'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertContains('class="form-control"', $result);
|
||||||
|
|
||||||
|
$result = $this->Form->input('date',
|
||||||
|
array(
|
||||||
|
'label' => false,
|
||||||
|
'type' => 'month',
|
||||||
|
'class' => 'form-control'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertContains('class="form-control"', $result);
|
||||||
|
|
||||||
|
$result = $this->Form->input('date',
|
||||||
|
array(
|
||||||
|
'label' => false,
|
||||||
|
'type' => 'year',
|
||||||
|
'class' => 'form-control'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertContains('class="form-control"', $result);
|
||||||
|
|
||||||
|
$result = $this->Form->input('date',
|
||||||
|
array(
|
||||||
|
'label' => false,
|
||||||
|
'type' => 'hour',
|
||||||
|
'class' => 'form-control'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$this->assertContains('class="form-control"', $result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testInputDateMaxYear method
|
* testInputDateMaxYear method
|
||||||
*
|
*
|
||||||
|
|
|
@ -2213,6 +2213,11 @@ class FormHelper extends AppHelper {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::year
|
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::year
|
||||||
*/
|
*/
|
||||||
public function year($fieldName, $minYear = null, $maxYear = null, $attributes = array()) {
|
public function year($fieldName, $minYear = null, $maxYear = null, $attributes = array()) {
|
||||||
|
if (is_array($minYear)) {
|
||||||
|
$attributes = $minYear;
|
||||||
|
$minYear = null;
|
||||||
|
}
|
||||||
|
|
||||||
$attributes += array('empty' => true, 'value' => null);
|
$attributes += array('empty' => true, 'value' => null);
|
||||||
if ((empty($attributes['value']) || $attributes['value'] === true) && $value = $this->value($fieldName)) {
|
if ((empty($attributes['value']) || $attributes['value'] === true) && $value = $this->value($fieldName)) {
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
|
@ -2310,6 +2315,11 @@ class FormHelper extends AppHelper {
|
||||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::hour
|
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::hour
|
||||||
*/
|
*/
|
||||||
public function hour($fieldName, $format24Hours = false, $attributes = array()) {
|
public function hour($fieldName, $format24Hours = false, $attributes = array()) {
|
||||||
|
if (is_array($format24Hours)) {
|
||||||
|
$attributes = $format24Hours;
|
||||||
|
$format24Hours = false;
|
||||||
|
}
|
||||||
|
|
||||||
$attributes += array('empty' => true, 'value' => null);
|
$attributes += array('empty' => true, 'value' => null);
|
||||||
$attributes = $this->_dateTimeSelected('hour', $fieldName, $attributes);
|
$attributes = $this->_dateTimeSelected('hour', $fieldName, $attributes);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue