Skip to content

Commit

Permalink
Fix fatal cause by possibly corrupt/invalid setting value.
Browse files Browse the repository at this point in the history
  • Loading branch information
pgk committed Dec 20, 2023
1 parent 19ae17e commit 06e0e2f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion includes/admin/class-wp-job-manager-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,10 @@ protected function output_field( $option, $value ) {
* @param string $placeholder
*/
protected function input_multi_enable_expand( $option, $attributes, $values, $placeholder ) {
if ( empty( $values ) ) {
$values = [];
}

echo '<div class="setting-enable-expand">';
$enable_option = $option['enable_field'];
$enable_option['name'] = $option['name'] . '[' . $enable_option['name'] . ']';
Expand All @@ -1103,7 +1107,9 @@ protected function input_multi_enable_expand( $option, $attributes, $values, $pl
$enable_option['attributes'][] = 'disabled="disabled"';
}

$this->input_checkbox( $enable_option, $enable_option['attributes'], $values[ $option['enable_field']['name'] ], null );
$value = $values[ $option['enable_field']['name'] ] ?? '';

$this->input_checkbox( $enable_option, $enable_option['attributes'], $value, null );

echo '<div class="sub-settings-expandable">';
$this->input_multi( $option, $attributes, $values, $placeholder );
Expand Down

0 comments on commit 06e0e2f

Please sign in to comment.