Plugin Directory

Changeset 2650379


Ignore:
Timestamp:
12/29/2021 09:41:43 AM (4 years ago)
Author:
kuicklist
Message:

Minor conditional fix

Location:
kuicklist
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kuicklist/tags/1.0.6/admin/class-kuicklist-admin.php

    r2650354 r2650379  
    187187
    188188                // Group by folders
    189                 foreach ($response->data as $key => $folder) {
    190                     $dd_html .= '<optgroup label="'.$folder->name.'">';
    191                     foreach ($folder->checklists as $checklist) {
    192                         $dd_html .= '<option value="'.$checklist->en_id.'" '.($kuicklist_checklist_id == $checklist->en_id ? 'selected' : '').' >'.$checklist->name.'</option>';
     189                foreach ($response->data as $key => $value) {
     190                    if(isset($value->checklists)) {
     191                        $dd_html .= '<optgroup label="'.$value->name.'">';
     192                        foreach ($value->checklists as $checklist) {
     193                            $dd_html .= '<option value="'.$checklist->en_id.'" '.($kuicklist_checklist_id == $checklist->en_id ? 'selected' : '').' >'.$checklist->name.'</option>';
     194                        }
     195
     196                        $dd_html .= '</optgroup>';
     197                    } else {
     198                        // fallback if user has cache the data as without folders structure
     199                        $dd_html .= '<option value="'.$value->en_id.'" '.($kuicklist_checklist_id == $value->en_id ? 'selected' : '').' >'.$value->name.'</option>';
    193200                    }
    194 
    195                     $dd_html .= '</optgroup>';
    196201                }
    197202
  • kuicklist/trunk/admin/class-kuicklist-admin.php

    r2650353 r2650379  
    187187
    188188                // Group by folders
    189                 foreach ($response->data as $key => $folder) {
    190                     $dd_html .= '<optgroup label="'.$folder->name.'">';
    191                     foreach ($folder->checklists as $checklist) {
    192                         $dd_html .= '<option value="'.$checklist->en_id.'" '.($kuicklist_checklist_id == $checklist->en_id ? 'selected' : '').' >'.$checklist->name.'</option>';
     189                foreach ($response->data as $key => $value) {
     190                    if(isset($value->checklists)) {
     191                        $dd_html .= '<optgroup label="'.$value->name.'">';
     192                        foreach ($value->checklists as $checklist) {
     193                            $dd_html .= '<option value="'.$checklist->en_id.'" '.($kuicklist_checklist_id == $checklist->en_id ? 'selected' : '').' >'.$checklist->name.'</option>';
     194                        }
     195
     196                        $dd_html .= '</optgroup>';
     197                    } else {
     198                        // fallback if user has cache the data as without folders structure
     199                        $dd_html .= '<option value="'.$value->en_id.'" '.($kuicklist_checklist_id == $value->en_id ? 'selected' : '').' >'.$value->name.'</option>';
    193200                    }
    194 
    195                     $dd_html .= '</optgroup>';
    196201                }
    197202
Note: See TracChangeset for help on using the changeset viewer.