DataSourceController.php in Forena Reports 8
File
src/Controller/DataSourceController.php
View source
<?php
namespace Drupal\forena\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Link;
use Drupal\forena\DataManager;
use Drupal\forena\Form\DataSourceDefinitionForm;
use Symfony\Component\HttpFoundation\Request;
class DataSourceController extends ControllerBase {
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::createFromRoute($this
->t('edit'), 'forena.configure.datasource', [
'source' => $name,
]),
];
}
if ($sources['#rows']) {
$content['data_sources'] = $sources;
}
return $content;
}
}