updated custom modules codes for d9
This commit is contained in:
@@ -8,6 +8,7 @@ use Drupal\Core\Url;
|
||||
use Drupal\Core\Language\LanguageInterface;
|
||||
use Drupal\menu_link_content\Entity\MenuLinkContent;
|
||||
use Drupal\Core\Datetime\DrupalDateTime;
|
||||
use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface;
|
||||
|
||||
// use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use \Drupal\block\Entity\Block;
|
||||
@@ -22,7 +23,7 @@ class EdlpAjaxController extends ControllerBase {
|
||||
$this->langcode = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
||||
|
||||
|
||||
$entity = entity_load($this->entity_type, $this->id);
|
||||
$entity = \Drupal::entityTypeManager()->getStorage($this->entity_type)->load($this->id);
|
||||
|
||||
if ($entity->hasTranslation($this->langcode)){
|
||||
$this->entity = $entity->getTranslation($this->langcode);
|
||||
@@ -51,21 +52,23 @@ class EdlpAjaxController extends ControllerBase {
|
||||
private function getProductionDatesAside(){
|
||||
|
||||
$now = new DrupalDateTime('now');
|
||||
$now->setTimezone(new \DateTimeZone(DATETIME_STORAGE_TIMEZONE));
|
||||
$now->setTimezone(new \DateTimeZone(DateTimeItemInterface::STORAGE_TIMEZONE));
|
||||
|
||||
$future_dates_query = \Drupal::entityQuery('node')
|
||||
->accessCheck(TRUE)
|
||||
->condition('status', 1)
|
||||
->condition('type', 'evenement')
|
||||
->condition('field_page_liee.target_id', $this->entity->id(), 'IN')
|
||||
->condition('field_date', $now->format(DATETIME_DATETIME_STORAGE_FORMAT), '>=')
|
||||
->condition('field_date', $now->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT), '>=')
|
||||
->sort('field_date');
|
||||
$future_nids = $future_dates_query->execute();
|
||||
|
||||
$past_dates_query = \Drupal::entityQuery('node')
|
||||
->accessCheck(TRUE)
|
||||
->condition('status', 1)
|
||||
->condition('type', 'evenement')
|
||||
->condition('field_page_liee.target_id', $this->entity->id(), 'IN')
|
||||
->condition('field_date', $now->format(DATETIME_DATETIME_STORAGE_FORMAT), '<')
|
||||
->condition('field_date', $now->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT), '<')
|
||||
->sort('field_date', 'DESC');
|
||||
$past_nids = $past_dates_query->execute();
|
||||
|
||||
@@ -81,7 +84,7 @@ class EdlpAjaxController extends ControllerBase {
|
||||
$node_view_builder = \Drupal::entityTypeManager()->getViewBuilder('node');
|
||||
|
||||
if(count($future_nids)){
|
||||
$future_nodes = entity_load_multiple('node', $future_nids);
|
||||
$future_nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($future_nids);
|
||||
$future_list = array (
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [],
|
||||
@@ -100,7 +103,7 @@ class EdlpAjaxController extends ControllerBase {
|
||||
}
|
||||
|
||||
if(count($past_nids)){
|
||||
$past_nodes = entity_load_multiple('node', $past_nids);
|
||||
$past_nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($past_nids);
|
||||
$past_list = array (
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [],
|
||||
|
||||
Reference in New Issue
Block a user