GetLoader()); $content = $fileManager->GetAssetString($formId, $fieldId . '.json'); if($content === null) return $options; $content = json_decode($content, true); if($content === null) return $options; if(!isset($options['Extra']['CSV'])) $options['Extra']['CSV'] = []; $items = []; foreach($content as $key => $value) { $currentItem = [ "L" => $key, ]; if(isset($value['Price'])) $currentItem['P'] = $value['Price']; $items[] = $currentItem; } usort($items, function ($a, $b) { return strcmp($a['L'], $b['L']); }); $options['Extra']['CSV'][$fieldId]['Items'] = $items; $options['Extra']['CSV'][$fieldId]['Nonce'] = wp_create_nonce('allinoneforms_csv_' . $formId . '_' . $fieldId); return $options; }