Open Data Catalog v2.0.0
Page.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Drupal\dkan_frontend\Page as PageBuilder;
6 use Symfony\Component\DependencyInjection\ContainerInterface;
7 use Symfony\Component\HttpFoundation\Response;
8 use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
9 
13 class Page implements ContainerInjectionInterface {
14 
15  private $pageBuilder;
16 
22  public static function create(ContainerInterface $container) {
23  return new Page($container->get('dkan_frontend.page'));
24  }
25 
29  public function __construct(PageBuilder $pageBuilder) {
30  $this->pageBuilder = $pageBuilder;
31  }
32 
36  public function page($name) {
37  $pageContent = $this->pageBuilder->build($name);
38  if (empty($pageContent)) {
39  $pageContent = $this->pageBuilder->build("404");
40  }
41  return Response::create($pageContent);
42  }
43 
47  public function dataset($name) {
48  $pageContent = $this->pageBuilder->buildDataset($name);
49  if (empty($pageContent)) {
50  $pageContent = $this->pageBuilder->build("404");
51  }
52 
53  return Response::create($pageContent);
54  }
55 
56 }
Drupal\dkan_frontend\Page
Definition: Page.php:10
Drupal\dkan_frontend\Controller\Page\__construct
__construct(PageBuilder $pageBuilder)
Definition: Page.php:29
Drupal\dkan_frontend\Controller\Page\dataset
dataset($name)
Definition: Page.php:47
Drupal\dkan_frontend\Controller
Definition: Page.php:3
Drupal\dkan_frontend\Controller\Page\create
static create(ContainerInterface $container)
Definition: Page.php:22
Drupal\dkan_frontend\Controller\Page
Definition: Page.php:13
Drupal\dkan_frontend\Controller\Page\page
page($name)
Definition: Page.php:36