updated custom modules codes for d9
This commit is contained in:
@@ -1,16 +1,7 @@
|
||||
# @Author: Bachir Soussi Chiadmi <bach>
|
||||
# @Date: 13-12-2017
|
||||
# @Email: bachir@figureslibres.io
|
||||
# @Filename: edlp_corpus.routing.yml
|
||||
# @Last modified by: bach
|
||||
# @Last modified time: 20-12-2017
|
||||
# @License: GPL-V3
|
||||
|
||||
|
||||
name: Edlp Agenda
|
||||
type: module
|
||||
description: Manage agenda for edlp d8.
|
||||
core: 8.x
|
||||
core_version_requirement: ^8 || ^9
|
||||
package: Edlp
|
||||
# dependencies:
|
||||
# - migrate_drupal
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
<?php
|
||||
|
||||
# @Author: Bachir Soussi Chiadmi <bach>
|
||||
# @Date: 13-12-2017
|
||||
# @Email: bachir@figureslibres.io
|
||||
# @Filename: edlp_corpus.routing.yml
|
||||
# @Last modified by: bach
|
||||
# @Last modified time: 20-12-2017
|
||||
# @License: GPL-V3
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
# @Author: Bachir Soussi Chiadmi <bach>
|
||||
# @Date: 13-12-2017
|
||||
# @Email: bachir@figureslibres.io
|
||||
# @Filename: edlp_corpus.routing.yml
|
||||
# @Last modified by: bach
|
||||
# @Last modified time: 20-12-2017
|
||||
# @License: GPL-V3
|
||||
|
||||
edlp_agenda.agenda:
|
||||
path: '/agenda'
|
||||
defaults:
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Drupal\edlp_agenda\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
use Drupal\Core\Datetime\DrupalDateTime;
|
||||
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
// use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
@@ -18,27 +19,29 @@ class AgendaController extends ControllerBase {
|
||||
// @see https://www.webomelette.com/query-entities-using-dates-drupal-8
|
||||
|
||||
$now = new DrupalDateTime('now');
|
||||
$now->setTimezone(new \DateTimeZone(DATETIME_STORAGE_TIMEZONE));
|
||||
$now->setTimezone(new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE));
|
||||
|
||||
$query = \Drupal::entityQuery('node')
|
||||
->accessCheck(TRUE)
|
||||
->condition('status', 1)
|
||||
->condition('type', 'evenement')
|
||||
->condition('field_date', $now->format(DATETIME_DATETIME_STORAGE_FORMAT), '>=')
|
||||
->condition('field_date', $now->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT), '>=')
|
||||
->sort('field_date');
|
||||
|
||||
$this->future_nids = $query->execute();
|
||||
$this->future_nodes = entity_load_multiple('node', $this->future_nids);
|
||||
$this->future_nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($this->future_nids);
|
||||
|
||||
// $this->next_event_node = array_shift($this->future_nodes);
|
||||
|
||||
$query = \Drupal::entityQuery('node')
|
||||
->accessCheck(TRUE)
|
||||
->condition('status', 1)
|
||||
->condition('type', 'evenement')
|
||||
->condition('field_date', $now->format(DATETIME_DATETIME_STORAGE_FORMAT), '<')
|
||||
->condition('field_date', $now->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT), '<')
|
||||
->sort('field_date', 'DESC');
|
||||
|
||||
$this->past_nids = $query->execute();
|
||||
$this->past_nodes = entity_load_multiple('node', $this->past_nids);
|
||||
$this->past_nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($this->past_nids);
|
||||
}
|
||||
|
||||
private function toRenderable(){
|
||||
|
||||
Reference in New Issue
Block a user