Skip to content

Commit a47ea00

Browse files
author
Marco Pereirinha
committed
When on read only mode, do not assume that the checkbox is checked
1 parent ab796a6 commit a47ea00

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

php/ui/component/class-on-off.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ protected function shadow( $struct ) {
123123
$struct = $this->get_part( 'input' );
124124
$struct['attributes']['type'] = 'checkbox';
125125
$struct['attributes']['disabled'] = 'disabled';
126-
$struct['attributes']['checked'] = 'checked';
127-
$struct['attributes']['type'] = 'checkbox';
126+
if ( 'on' === $this->setting->get_value() ) {
127+
$struct['attributes']['checked'] = 'checked';
128+
}
128129
}
129130

130131
return $struct;

ui-definitions/settings-image.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
'data-context' => 'image',
5656
),
5757
'readonly' => static function () {
58-
return ! get_plugin_instance()->get_component( 'storage' )->is_local_full();
58+
$plugin = get_plugin_instance();
59+
return 'on' === $plugin->settings->get_value( 'image_delivery' ) && ! $plugin->get_component( 'storage' )->is_local_full();
5960
},
6061
'readonly_message' => sprintf(
6162
// translators: %s is a link to the storage settings page.

ui-definitions/settings-video.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
'data-context' => 'video',
5656
),
5757
'readonly' => static function () {
58-
return ! get_plugin_instance()->get_component( 'storage' )->is_local_full();
58+
$plugin = get_plugin_instance();
59+
return 'on' === $plugin->settings->get_value( 'video_delivery' ) && ! $plugin->get_component( 'storage' )->is_local_full();
5960
},
6061
'readonly_message' => sprintf(
6162
// translators: %s is a link to the storage settings page.

0 commit comments

Comments
 (0)