Skip to content

Commit

Permalink
add condition to check if is array
Browse files Browse the repository at this point in the history
  • Loading branch information
zubairraeen committed Aug 28, 2024
2 parents 520d12f + db7e313 commit 81a2c15
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions php/admin/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1434,10 +1434,17 @@ function qsm_admin_upgrade_content( $args = array(), $type = 'popup' ) {
* @return html
*/
function qsm_quiz_theme_settings( $type, $label, $name, $value, $default_value, $options = array( 'button_text' => '' ) ) {
$tooltip = '';
if ( isset( $options['helper_text'] ) && '' !== $options['helper_text'] ) {
$tooltip .= '<span class="dashicons dashicons-editor-help qsm-tooltips-icon">';
$tooltip .= '<span class="qsm-tooltips">' . esc_html( $options['helper_text'] ) . '</span>';
$tooltip .= '</span>';
}
?>
<tr valign="top">
<th scope="row" class="qsm-opt-tr">
<label for="form_type"><?php echo esc_attr( $label ); ?></label>
<?php echo wp_kses_post( $tooltip ); ?>
</th>
<td align ="right">
<?php
Expand Down
8 changes: 5 additions & 3 deletions php/template-variables.php
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,11 @@ function qsm_all_contact_fields_variable( $content, $results ) {
return $content;
}
function qsm_get_options_of_contact_fields( $data, $label, $type ) {
foreach ( $data as $item ) {
if ( $item['label'] === $label && $item['type'] === $type ) {
return $item['options'];
if( is_array( $data ) ){
foreach ( $data as $item ) {
if ( $item['label'] === $label && $item['type'] === $type ) {
return $item['options'];
}
}
}
return null; // Option not found
Expand Down

0 comments on commit 81a2c15

Please sign in to comment.