Skip to content

Commit 3984e33

Browse files
author
Marco Pereirinha
committed
When on read only mode, do not assume that the checkbox is checked
1 parent 45a5b12 commit 3984e33

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
@@ -46,7 +46,8 @@
4646
'data-context' => 'image',
4747
),
4848
'readonly' => static function () {
49-
return ! get_plugin_instance()->get_component( 'storage' )->is_local_full();
49+
$plugin = get_plugin_instance();
50+
return 'on' === $plugin->settings->get_value( 'image_delivery' ) && ! $plugin->get_component( 'storage' )->is_local_full();
5051
},
5152
'readonly_message' => sprintf(
5253
// 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
@@ -46,7 +46,8 @@
4646
'data-context' => 'video',
4747
),
4848
'readonly' => static function () {
49-
return ! get_plugin_instance()->get_component( 'storage' )->is_local_full();
49+
$plugin = get_plugin_instance();
50+
return 'on' === $plugin->settings->get_value( 'video_delivery' ) && ! $plugin->get_component( 'storage' )->is_local_full();
5051
},
5152
'readonly_message' => sprintf(
5253
// translators: %s is a link to the storage settings page.

0 commit comments

Comments
 (0)