Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion layouts/joomla/form/field/color/advanced.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
$disabled = $disabled ? ' disabled' : '';
$readonly = $readonly ? ' readonly' : '';
$hint = strlen($hint) ? ' placeholder="' . $this->escape($hint) . '"' : ' placeholder="' . $placeholder . '"';
$autocomplete = ! $autocomplete ? ' autocomplete="off"' : '';
$autocomplete = !empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '';

// Force LTR input value in RTL, due to display issues with rgba/hex colors
$direction = $lang->isRtl() ? ' dir="ltr" style="text-align:right"' : '';
Expand Down
2 changes: 1 addition & 1 deletion layouts/joomla/form/field/color/slider.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}

$alpha = $format === 'hsla' || $format === 'rgba' || $format === 'alpha';
$autocomplete = !$autocomplete ? ' autocomplete="off"' : '';
$autocomplete = !empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '';
$autofocus = $autofocus ? ' autofocus' : '';
$color = ' data-color="' . $color . '"';
$class = $class ? ' class="' . $class . '"' : '';
Expand Down
5 changes: 1 addition & 4 deletions layouts/joomla/form/field/email.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,14 @@
* @var string $accept File types that are accepted.
*/

$autocomplete = !$autocomplete ? 'autocomplete="off"' : 'autocomplete="' . $autocomplete . '"';
$autocomplete = $autocomplete === 'autocomplete="on"' ? '' : $autocomplete;

$attributes = array(
$spellcheck ? '' : 'spellcheck="false"',
!empty($size) ? 'size="' . $size . '"' : '',
!empty($description) ? 'aria-describedby="' . $name . '-desc"' : '',
$disabled ? 'disabled' : '',
$readonly ? 'readonly' : '',
$onchange ? 'onchange="' . $onchange . '"' : '',
$autocomplete,
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$multiple ? 'multiple' : '',
!empty($maxLength) ? 'maxlength="' . $maxLength . '"' : '',
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
Expand Down
5 changes: 1 addition & 4 deletions layouts/joomla/form/field/number.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
* @var string $accept File types that are accepted.
*/

$autocomplete = !$autocomplete ? ' autocomplete="off"' : ' autocomplete="' . $autocomplete . '"';
$autocomplete = $autocomplete === ' autocomplete="on"' ? '' : $autocomplete;

$attributes = array(
!empty($class) ? 'class="form-control ' . $class . '"' : 'class="form-control"',
!empty($description) ? 'aria-describedby="' . $name . '-desc"' : '',
Expand All @@ -58,7 +55,7 @@
!empty($step) ? 'step="' . $step . '"' : '',
isset($min) ? 'min="' . $min . '"' : '',
$required ? 'required' : '',
$autocomplete,
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? 'autofocus' : ''
);

Expand Down
2 changes: 1 addition & 1 deletion layouts/joomla/form/field/password.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

$attributes = array(
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
!$autocomplete ? 'autocomplete="off"' : '',
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
!empty($class) ? 'class="form-control ' . $class . '"' : 'class="form-control"',
$readonly ? 'readonly' : '',
$disabled ? 'disabled' : '',
Expand Down
5 changes: 1 addition & 4 deletions layouts/joomla/form/field/tel.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,13 @@
* @var integer $maxLength The maximum length that the field shall accept.
*/

$autocomplete = !$autocomplete ? 'autocomplete="off"' : 'autocomplete="' . $autocomplete . '"';
$autocomplete = $autocomplete === 'autocomplete="on"' ? '' : $autocomplete;

$attributes = array(
!empty($size) ? 'size="' . $size . '"' : '',
!empty($description) ? 'aria-describedby="' . $name . '-desc"' : '',
$disabled ? 'disabled' : '',
$readonly ? 'readonly' : '',
strlen($hint) ? 'placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
$autocomplete,
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? 'autofocus' : '',
$spellcheck ? '' : 'spellcheck="false"',
$onchange ? 'onchange="' . $onchange . '"' : '',
Expand Down
5 changes: 1 addition & 4 deletions layouts/joomla/form/field/text.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@
$list = 'list="' . $id . '_datalist"';
}

$autocomplete = !$autocomplete ? ' autocomplete="off"' : ' autocomplete="' . $autocomplete . '"';
$autocomplete = $autocomplete === ' autocomplete="on"' ? '' : $autocomplete;

$attributes = array(
!empty($class) ? 'class="form-control ' . $class . '"' : 'class="form-control"',
!empty($size) ? 'size="' . $size . '"' : '',
Expand All @@ -67,7 +64,7 @@
$onchange ? ' onchange="' . $onchange . '"' : '',
!empty($maxLength) ? $maxLength : '',
$required ? 'required' : '',
$autocomplete,
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? ' autofocus' : '',
$spellcheck ? '' : 'spellcheck="false"',
!empty($inputmode) ? $inputmode : '',
Expand Down
7 changes: 1 addition & 6 deletions layouts/joomla/form/field/textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@
* @var string $accept File types that are accepted.
*/

// Initialize some field attributes.
$autocomplete = !$autocomplete ? 'autocomplete="off"' : 'autocomplete="' . $autocomplete . '"';
$autocomplete = $autocomplete === 'autocomplete="on"' ? '' : $autocomplete;

$attributes = array(
$columns ?: '',
$rows ?: '',
Expand All @@ -59,11 +55,10 @@
$onchange ? 'onchange="' . $onchange . '"' : '',
$onclick ? 'onclick="' . $onclick . '"' : '',
$required ? 'required' : '',
$autocomplete,
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? 'autofocus' : '',
$spellcheck ? '' : 'spellcheck="false"',
$maxlength ? $maxlength: ''

);
?>
<textarea name="<?php
Expand Down
5 changes: 1 addition & 4 deletions layouts/joomla/form/field/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,13 @@
* @var string $accept File types that are accepted.
*/

$autocomplete = !$autocomplete ? ' autocomplete="off"' : ' autocomplete="' . $autocomplete . '"';
$autocomplete = $autocomplete === ' autocomplete="on"' ? '' : $autocomplete;

$attributes = array(
!empty($size) ? ' size="' . $size . '"' : '',
!empty($description) ? ' aria-describedby="' . $name . '-desc"' : '',
$disabled ? ' disabled' : '',
$readonly ? ' readonly' : '',
strlen($hint) ? ' placeholder="' . htmlspecialchars($hint, ENT_COMPAT, 'UTF-8') . '"' : '',
$autocomplete,
!empty($autocomplete) ? 'autocomplete="' . $autocomplete . '"' : '',
$autofocus ? ' autofocus' : '',
$spellcheck ? '' : ' spellcheck="false"',
$onchange ? ' onchange="' . $onchange . '"' : '',
Expand Down
4 changes: 1 addition & 3 deletions libraries/src/Form/FormField.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,9 +510,7 @@ public function __set($name, $value)
break;

case 'autocomplete':
$value = (string) $value;
$value = ($value == 'on' || $value == '') ? 'on' : $value;
$this->$name = ($value === 'false' || $value === 'off' || $value === '0') ? false : $value;
$this->$name = (string) $value;
break;

case 'spellcheck':
Expand Down