Open global configuration and see outer html of the field "Search Engine Friendly URLs"
<joomla-field-switcher id="jform_sef" off-text="No" on-text="Yes" type="success">
<span class="switcher active has-success" tabindex="0" aria-checked="true" role="switch" aria-label="Yes"><input id="jform_sef0" name="jform[sef]" value="0" tabindex="-1" class="valid form-control-success" aria-invalid="false" type="radio"><input id="jform_sef1" name="jform[sef]" value="1" class="valid active form-control-success" tabindex="-1" checked="" aria-invalid="false" type="radio"><span class="switch"></span></span><span class="switcher-labels"><span class="switcher-label-0">No</span><span class="switcher-label-1 active">Yes</span></span></joomla-field-switcher>
Open /administrator/components/com_config/forms/application.xml
and change the field (insert disabled="true"
)
<field
name="sef"
type="radio"
label="COM_CONFIG_FIELD_SEF_URL_LABEL"
class="switcher"
default="1"
filter="boolean"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
to
<field
name="sef"
type="radio"
label="COM_CONFIG_FIELD_SEF_URL_LABEL"
class="switcher"
disabled="true"
default="1"
filter="boolean"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
Open again global configuration and see outer html of the field "Search Engine Friendly URLs". Now the text disabled=""
is added.
<joomla-field-switcher id="jform_sef" off-text="No" on-text="Yes" disabled="" type="success">
<span class="switcher active has-success" tabindex="0" aria-checked="true" role="switch" aria-label="Yes"><input id="jform_sef0" name="jform[sef]" value="0" tabindex="-1" class="valid form-control-success" aria-invalid="false" type="radio"><input id="jform_sef1" name="jform[sef]" value="1" class="valid active form-control-success" tabindex="-1" checked="" aria-invalid="false" type="radio"><span class="switch"></span></span><span class="switcher-labels"><span class="switcher-label-0">No</span><span class="switcher-label-1 active">Yes</span></span></joomla-field-switcher>
The field "Search Engine Friendly URLs" is disabled.
Nothing changed. The field works as before.
Current 4.0-dev branch on ubuntu
My guess:
In the layout file
/layouts/joomla/form/field/radio/switcher.php
disabled is added. But the value of the attributes must be set. Also in the file
/media/system/webcomponents/js/joomla-field-switcher.js
this attribute must be implemented.
Labels |
Added:
?
|
Category | ⇒ | Administration |
Status | New | ⇒ | Discussion |
Labels |
Added:
J4 Issue
|
@Anu1601CS yes I see the issue.
Remove this block of code: https://github.com/joomla/joomla-cms/blob/4.0-dev/layouts/joomla/form/field/radio/switcher.php#L82-L85
Then replace this line, with:
$disabled = !empty($disabled) ? 'disabled' : '';
$attributes = array_filter(array($checked, $active, null, $onchange, $onclick, disabled));
That will prevent you from being able to click the switcher.
You then of course need to prevent spacebar
and enter
buttons from triggering a switch.
To do that, replace this function with:
keyEvents(event) {
if (event.keyCode === KEYCODE.ENTER || event.keyCode === KEYCODE.SPACE) {
event.preventDefault();
if (!this.inputs[1].disabled) {
this.toggle.bind(this)();
}
}
}
Not tested but should work.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-06-29 09:49:49 |
Closed_By | ⇒ | brianteeman |
@C-Lodder Any idea ?