Skip to content

Instantly share code, notes, and snippets.

@lucalanca
Created December 11, 2018 15:35
Show Gist options
  • Save lucalanca/36954d31f7058f2c64cbe1b1a0b5e4b1 to your computer and use it in GitHub Desktop.
Save lucalanca/36954d31f7058f2c64cbe1b1a0b5e4b1 to your computer and use it in GitHub Desktop.
Load all cockpit descriptions at once
# /config/api/public/singletons.php
# GET /api/public/singletons
# GET /api/public/singletons?lang=de
<?php
$options = [];
$response = [];
if ($lang = $this->param('lang', false)) $options['lang'] = $lang;
foreach ($this->module('singletons')->singletons() as $name => $singleton) {
$response[$name] = $this->module('singletons')->getData($name, $options);
}
return $response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment