public function DataSourceController::listDataSources in Forena Reports 8
List the data sources in use by Forena.
1 string reference to 'DataSourceController::listDataSources'
File
- src/
Controller/ DataSourceController.php, line 23
Class
Namespace
Drupal\forena\ControllerCode
public function listDataSources() {
$repos = DataManager::instance()->repositories;
$r_list = array();
$headers = array(
t('Name'),
t('Description'),
t('source'),
t('Operation'),
);
$sources = [
'#type' => 'table',
'#rows' => [],
];
foreach ($repos as $name => $r) {
$title = isset($r['title']) ? $r['title'] : $name;
$sources['#rows'][] = [
$name,
$title,
$r['source'],
// $link to configure
Link::createFromRoute($this
->t('edit'), 'forena.configure.datasource', [
'source' => $name,
]),
];
}
// @FIXME Provide a valid URL, generated from a route name, as the second argument to l(). See https://www.drupal.org/node/2346779 for more information.
// $output = '<ul class="action-links"><li>' . l(t('Add data source'), 'admin/config/content/forena/data/add') . '</li></ul>';
if ($sources['#rows']) {
$content['data_sources'] = $sources;
}
return $content;
}