Skip to content

Commit

Permalink
Update to use key for settings array (#2674)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeyarce authored Dec 8, 2023
1 parent 3562839 commit 02dfcda
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions includes/admin/class-wp-job-manager-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -855,15 +855,14 @@ protected function multiple_choice_output( $option, $value, $type ) {
echo ' <p class="description">' . wp_kses_post( $option['desc'] ) . '</p>';
}
foreach ( $option['options'] as $key => $name ) {
$input_name = esc_attr( 'checkbox' === $type ? $option['name'] . '[fields][]' : $option['name'] );
$input_type = esc_attr( $type );
$input_value = esc_attr( 'checkbox' === $type ? strtolower( $name ) : $key );
$is_checked = 'checkbox' === $type
? checked( isset( $value['fields'] ) && is_array( $value['fields'] ) && in_array( strtolower( $name ), $value['fields'], true ), true, 0 )
$input_name = esc_attr( 'checkbox' === $type ? $option['name'] . '[fields][' . $key . ']' : $option['name'] );
$input_type = esc_attr( $type );
$is_checked = 'checkbox' === $type
? checked( isset( $value['fields'] ) && is_array( $value['fields'] ) && in_array( $key, $value['fields'], true ), true, 0 )
: checked( $value, $key, false );
$label = esc_html( $name );
$label = esc_html( $name );

echo "<label><input name='{$input_name}' type='{$input_type}' value='{$input_value}' {$is_checked} />{$label}</label><br>"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo "<label><input name='{$input_name}' type='{$input_type}' value='{$key}' {$is_checked} />{$label}</label><br>"; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
?>
</fieldset>
Expand Down

0 comments on commit 02dfcda

Please sign in to comment.