function shorten_cs_shorten_service in Shorten URLs 8.2
Same name and namespace in other branches
- 8 modules/shorten_cs/shorten_cs.module \shorten_cs_shorten_service()
- 6 shorten_cs.module \shorten_cs_shorten_service()
- 7.2 shorten_cs.module \shorten_cs_shorten_service()
- 7 shorten_cs.module \shorten_cs_shorten_service()
Implements hook_shorten_service().
File
- modules/
shorten_cs/ shorten_cs.module, line 43 - Allows users to specify custom services for the Shorten URLs module.
Code
function shorten_cs_shorten_service() {
$result = \Drupal::database()
->query("SELECT * FROM {shorten_cs}")
->fetchAll();
$services = [];
foreach ($result as $service) {
$services[$service->name] = [
'custom' => $service->type == 'text' ? FALSE : $service->type,
'url' => $service->url,
];
if ($service->type == 'xml') {
$services[$service->name]['tag'] = $service->tag;
}
elseif ($service->type == 'json') {
$services[$service->name]['json'] = $service->tag;
}
}
return $services;
}