Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4961 - Fix read-only not having any effect on checkbox fields #5164

Merged
merged 1 commit into from Dec 5, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions ui/fields/checkbox.php
Expand Up @@ -62,6 +62,7 @@

if ( pods_var( 'readonly', $options, false ) ) {
$attributes['readonly'] = 'READONLY';
$attributes['disabled'] = 'DISABLED';

$attributes['class'] .= ' pods-form-ui-read-only';
}
Expand All @@ -79,6 +80,12 @@
<div class="pods-field pods-boolean"<?php echo $indent; ?>>
<input<?php PodsForm::attributes( $attributes, $name, $form_field_type, $options ); ?> />
<?php
if ( isset( $attributes['readonly'] ) && isset( $attributes['checked'] ) && 'CHECKED' === $attributes['checked'] ) {
?>
<input type="hidden" name="<?php echo esc_attr( $name ); ?>" value="<?php echo esc_attr( $attributes['value'] ); ?>" />
<?php
}

if ( 0 < strlen( $label ) ) {
$help = pods_var_raw( 'help', $options );

Expand Down