Open Data Catalog v2.0.0
Controller.php
Go to the documentation of this file.
1 <?php
2 
4 
5 use Drupal\Core\Controller\ControllerBase;
6 use Symfony\Component\DependencyInjection\ContainerInterface;
7 use Drupal\Component\Uuid\Php;
8 
12 class Controller extends ControllerBase {
13 
19  protected $uuidService;
20 
24  public function __construct(Php $uuid) {
25  $this->uuidService = $uuid;
26  }
27 
31  public static function create(ContainerInterface $container) {
32  // Instantiates this service class.
33  return new static(
34  // Load the service required to construct this class.
35  $container->get('uuid')
36  );
37  }
38 
42  public function page() {
43  // Generate a uuid for new datasets, pass it to the form.
44  $uuid = $this->uuidService->generate();
45 
46  return [
47  '#markup' => '<div id="app"></div>',
48  '#attached' => [
49  'library' => [
50  'dkan_metadata_form/dkan_metadata_form',
51  ],
52  'drupalSettings' => [
53  'tempUUID' => $uuid,
54  ],
55  ],
56  ];
57  }
58 
59 }
Drupal\dkan_metadata_form
Definition: Controller.php:3
Drupal\dkan_metadata_form\Controller
Definition: Controller.php:12
Drupal\dkan_metadata_form\Controller\page
page()
Definition: Controller.php:42
Drupal\dkan_metadata_form\Controller\__construct
__construct(Php $uuid)
Definition: Controller.php:24
Drupal\dkan_metadata_form\Controller\create
static create(ContainerInterface $container)
Definition: Controller.php:31
Drupal\dkan_metadata_form\Controller\$uuidService
$uuidService
Definition: Controller.php:19