2019-03-25 18:28:17 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Drupal\materio_home\Controller;
|
|
|
|
|
|
|
|
use Drupal\Core\Controller\ControllerBase;
|
|
|
|
use Drupal\Core\Datetime\DrupalDateTime;
|
|
|
|
use Drupal\taxonomy\Entity\Term;
|
|
|
|
use Drupal\workflow\Entity\WorkflowManager;
|
|
|
|
use Drupal\Core\Url;
|
|
|
|
use Drupal\Core\Language\LanguageInterface;
|
|
|
|
// use Symfony\Component\HttpFoundation\JsonResponse;
|
|
|
|
use Drupal\Core\Cache\CacheableJsonResponse;
|
|
|
|
use Drupal\Core\Cache\CacheableMetadata;
|
|
|
|
use Drupal\core\render\RenderContext;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class HomeController extends ControllerBase {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display home as a page.
|
|
|
|
*
|
|
|
|
* @return renderable array
|
|
|
|
*/
|
|
|
|
public function home() {
|
|
|
|
|
|
|
|
// $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
|
|
|
|
|
|
|
$contents = array("#theme"=>'materio_home');
|
|
|
|
|
2019-05-23 17:52:46 +02:00
|
|
|
// presentation
|
|
|
|
$query = \Drupal::entityQuery('node')
|
|
|
|
->condition('status', 1)
|
|
|
|
->condition('nid', 19990);
|
|
|
|
// TODO: présentation nid should be a setting
|
|
|
|
|
|
|
|
$pres_nid = $query->execute();
|
|
|
|
$contents["#frontpage_node"] = entity_load('node', array_pop($pres_nid));
|
|
|
|
|
2019-03-25 18:28:17 +01:00
|
|
|
return $contents;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|