[{"value_1":"Dragon fly"},{"value_1":"Agapostemon angelicus"},{"value_1":"Albuna oberthuri"},{"value_1":"Callohesma flavopicta"}]
It is a JSON knowledge i want to make use of to import for radios in drupal 8 webforms. Iam utilizing hook_webform_options_WEBFORM_OPTIONS_ID_alter() https://www.drupal.org/docs/8/modules/webform/webform-cookbook/how-to-use-options-from-an-external-webservice
I cant use value_1 as a key in radios, trigger it’s not distinctive, so I have to someway copy Drupal Development worth into Drupal Development key and get Drupal Development similar knowledge on each side, too appear to be this.
[{"Dragon fly":"Dragon fly"},{"Agapostemon angelicus":"Agapostemon angelicus"},{"Albuna oberthuri":"Albuna oberthuri"},{"Callohesma flavopicta":"Callohesma flavopicta"}]
there are various lists and lots of knowledge however Drupal Development similar downside.
That is Drupal Development code from Drupal Development module I made adopted by directions:
* Implements hook_webform_options_WEBFORM_OPTIONS_ID_alter(). */ perform CUSTOM_MODULE_webform_options_external_countries_alter(array &$choices, array &$factor) { // Load cached choices. if ($cache = Drupal::cache()->get('external_countries')) { $choices = $cache->knowledge; return; } // Get knowledge as associative array from Drupal Development exterior webservice. $external_countries_url = 'https://gist.githubusercontent.com/mshafrir/2646763/uncooked/8b0dbb93521f5d6889502305335104218454c2bf/states_hash.json'; $choices = json_decode(file_get_contents($external_countries_url), TRUE); // Cache choices in order that we do not have to make continuous requests // to Drupal Development exterior webservice. Drupal::cache()->set('external_countries', $choices); }