From cbac2d9946f3a25037f3da74b26b494d2a319163 Mon Sep 17 00:00:00 2001 From: bach Date: Mon, 16 Sep 2024 21:48:07 +0200 Subject: [PATCH] updated custom modules codes for d9 --- composer.json | 3 + composer.lock | 256 ++++++++++++++++++ config/sync/core.extension.yml | 4 + .../custom/edlp_admin/edlp_admin.info.yml | 2 +- .../custom/edlp_agenda/edlp_agenda.info.yml | 11 +- .../custom/edlp_agenda/edlp_agenda.module | 8 - .../edlp_agenda/edlp_agenda.routing.yml | 8 - .../src/Controller/AgendaController.php | 13 +- .../custom/edlp_ajax/edlp_ajax.info.yml | 2 +- .../custom/edlp_ajax/edlp_ajax.routing.yml | 8 - .../src/Controller/EdlpAjaxController.php | 15 +- .../custom/edlp_corpus/edlp_corpus.info.yml | 14 +- .../edlp_corpus/edlp_corpus.libraries.yml | 12 +- .../custom/edlp_corpus/edlp_corpus.module | 19 +- .../edlp_corpus/edlp_corpus.routing.yml | 8 - .../src/Controller/CorpusController.php | 22 +- .../src/Plugin/Block/BlockEntrees.php | 5 +- .../src/Plugin/Filter/AudioLinksFilter.php | 2 +- .../custom/edlp_fils/edlp_fils.info.yml | 2 +- .../custom/edlp_home/edlp_home.info.yml | 2 +- .../src/Controller/HomeController.php | 44 +-- .../custom/edlp_migrate/edlp_migrate.info.yml | 2 +- .../custom/edlp_mobile/edlp_mobile.info.yml | 2 +- .../edlp_productions.info.yml | 2 +- .../edlp_productions.routing.yml | 8 - .../src/Controller/ProductionsController.php | 3 +- .../custom/edlp_search/edlp_search.info.yml | 2 +- .../src/Controller/EdlpSearchController.php | 2 +- .../edlp_search/src/Form/EdlpSearchForm.php | 5 +- .../custom/edlp_studio/edlp_studio.info.yml | 2 +- .../edlp_studio/edlp_studio.libraries.yml | 6 +- .../src/Controller/ChutierController.php | 6 +- .../src/Controller/CompositionController.php | 8 +- .../src/Controller/StudioUIController.php | 10 +- .../custom/edlp_studio/src/Entity/Chutier.php | 5 +- .../edlp_studio/src/Form/ChutierForm.php | 4 +- .../edlp_studio/src/Form/CompositionForm.php | 4 +- .../custom/edlptheme/edlptheme.info.yml | 2 +- 38 files changed, 375 insertions(+), 158 deletions(-) diff --git a/composer.json b/composer.json index 026299533..bd3a9c46e 100644 --- a/composer.json +++ b/composer.json @@ -49,6 +49,9 @@ "drupal/filefield_sources": "^1.0@alpha", "drupal/filter_perms": "^1.0@alpha", "drupal/honeypot": "^2.0", + "drupal/jquery_ui_draggable": "^1.2", + "drupal/jquery_ui_droppable": "^1.2", + "drupal/jquery_ui_sortable": "^1.1", "drupal/linkit": "^5.0", "drupal/login_emailusername": "^2.1", "drupal/maillog": "^1.0@beta", diff --git a/composer.lock b/composer.lock index d0e7450ad..86037b575 100644 --- a/composer.lock +++ b/composer.lock @@ -3646,6 +3646,262 @@ "issues": "https://www.drupal.org/project/issues/honeypot" } }, + { + "name": "drupal/jquery_ui", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/jquery_ui.git", + "reference": "8.x-1.4" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/jquery_ui-8.x-1.4.zip", + "reference": "8.x-1.4", + "shasum": "64c19ecc8902e2b4b1ab0cc5f5fe28dbc83bfebe" + }, + "require": { + "drupal/core": "^8 || ^9" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.4", + "datestamp": "1582149957", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "bnjmnm", + "homepage": "https://www.drupal.org/user/2369194" + }, + { + "name": "jjeff", + "homepage": "https://www.drupal.org/user/17190" + }, + { + "name": "lauriii", + "homepage": "https://www.drupal.org/user/1078742" + }, + { + "name": "litwol", + "homepage": "https://www.drupal.org/user/78134" + }, + { + "name": "mfb", + "homepage": "https://www.drupal.org/user/12302" + }, + { + "name": "mfer", + "homepage": "https://www.drupal.org/user/25701" + }, + { + "name": "mikelutz", + "homepage": "https://www.drupal.org/user/2972409" + }, + { + "name": "nod_", + "homepage": "https://www.drupal.org/user/598310" + }, + { + "name": "phenaproxima", + "homepage": "https://www.drupal.org/user/205645" + }, + { + "name": "RobLoach", + "homepage": "https://www.drupal.org/user/61114" + }, + { + "name": "sun", + "homepage": "https://www.drupal.org/user/54136" + }, + { + "name": "webchick", + "homepage": "https://www.drupal.org/user/24967" + }, + { + "name": "Wim Leers", + "homepage": "https://www.drupal.org/user/99777" + }, + { + "name": "zrpnr", + "homepage": "https://www.drupal.org/user/1448368" + } + ], + "description": "Provides jQuery UI library.", + "homepage": "https://www.drupal.org/project/jquery_ui", + "support": { + "source": "https://git.drupalcode.org/project/jquery_ui" + } + }, + { + "name": "drupal/jquery_ui_draggable", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/jquery_ui_draggable.git", + "reference": "8.x-1.2" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/jquery_ui_draggable-8.x-1.2.zip", + "reference": "8.x-1.2", + "shasum": "09e17046e38aebf84ed573822b0d5be6de3f0c94" + }, + "require": { + "drupal/core": "^8 || ^9", + "drupal/jquery_ui": "*" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.2", + "datestamp": "1582150027", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "bnjmnm", + "homepage": "https://www.drupal.org/user/2369194" + }, + { + "name": "lauriii", + "homepage": "https://www.drupal.org/user/1078742" + }, + { + "name": "zrpnr", + "homepage": "https://www.drupal.org/user/1448368" + } + ], + "description": "Provides jQuery UI Draggable library.", + "homepage": "https://www.drupal.org/project/jquery_ui_draggable", + "support": { + "source": "https://git.drupalcode.org/project/jquery_ui_draggable" + } + }, + { + "name": "drupal/jquery_ui_droppable", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/jquery_ui_droppable.git", + "reference": "8.x-1.2" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/jquery_ui_droppable-8.x-1.2.zip", + "reference": "8.x-1.2", + "shasum": "6e53043f2d3215f211721eea4d4c6ab5d1672b14" + }, + "require": { + "drupal/core": "^8 || ^9", + "drupal/jquery_ui": "*", + "drupal/jquery_ui_draggable": "*" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.2", + "datestamp": "1582150071", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "bnjmnm", + "homepage": "https://www.drupal.org/user/2369194" + }, + { + "name": "lauriii", + "homepage": "https://www.drupal.org/user/1078742" + }, + { + "name": "zrpnr", + "homepage": "https://www.drupal.org/user/1448368" + } + ], + "description": "Provides jQuery UI Droppable library.", + "homepage": "https://www.drupal.org/project/jquery_ui_droppable", + "support": { + "source": "https://git.drupalcode.org/project/jquery_ui_droppable" + } + }, + { + "name": "drupal/jquery_ui_sortable", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/jquery_ui_sortable.git", + "reference": "8.x-1.1" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/jquery_ui_sortable-8.x-1.1.zip", + "reference": "8.x-1.1", + "shasum": "dbb64f4e8f57b08a3e0ddd2e5cc3ba8d27d2722f" + }, + "require": { + "drupal/core": "^8 || ^9", + "drupal/jquery_ui": "*" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.1", + "datestamp": "1583174744", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "bnjmnm", + "homepage": "https://www.drupal.org/user/2369194" + }, + { + "name": "lauriii", + "homepage": "https://www.drupal.org/user/1078742" + }, + { + "name": "zrpnr", + "homepage": "https://www.drupal.org/user/1448368" + } + ], + "description": "Provides jQuery UI Sortable library.", + "homepage": "https://www.drupal.org/project/jquery_ui_sortable", + "support": { + "source": "https://git.drupalcode.org/project/jquery_ui_sortable" + } + }, { "name": "drupal/linkit", "version": "5.0.0-beta11", diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 1a7cd5d7c..5b6f27f25 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -56,6 +56,10 @@ module: help: 0 honeypot: 0 image: 0 + jquery_ui: 0 + jquery_ui_draggable: 0 + jquery_ui_droppable: 0 + jquery_ui_sortable: 0 language: 0 link: 0 linkit: 0 diff --git a/web/modules/custom/edlp_admin/edlp_admin.info.yml b/web/modules/custom/edlp_admin/edlp_admin.info.yml index 15bc300af..dc0460189 100644 --- a/web/modules/custom/edlp_admin/edlp_admin.info.yml +++ b/web/modules/custom/edlp_admin/edlp_admin.info.yml @@ -10,5 +10,5 @@ name: Edlp Admin type: module description: Admin helpers for edlp d8. -core: 8.x +core_version_requirement: ^8 || ^9 package: Edlp diff --git a/web/modules/custom/edlp_agenda/edlp_agenda.info.yml b/web/modules/custom/edlp_agenda/edlp_agenda.info.yml index 65bc6b8c8..86fa51eec 100644 --- a/web/modules/custom/edlp_agenda/edlp_agenda.info.yml +++ b/web/modules/custom/edlp_agenda/edlp_agenda.info.yml @@ -1,16 +1,7 @@ -# @Author: Bachir Soussi Chiadmi -# @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 diff --git a/web/modules/custom/edlp_agenda/edlp_agenda.module b/web/modules/custom/edlp_agenda/edlp_agenda.module index 92b3ce541..0458d2ad0 100644 --- a/web/modules/custom/edlp_agenda/edlp_agenda.module +++ b/web/modules/custom/edlp_agenda/edlp_agenda.module @@ -1,13 +1,5 @@ -# @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(). */ diff --git a/web/modules/custom/edlp_agenda/edlp_agenda.routing.yml b/web/modules/custom/edlp_agenda/edlp_agenda.routing.yml index 53be06e3b..7931a79e4 100644 --- a/web/modules/custom/edlp_agenda/edlp_agenda.routing.yml +++ b/web/modules/custom/edlp_agenda/edlp_agenda.routing.yml @@ -1,11 +1,3 @@ -# @Author: Bachir Soussi Chiadmi -# @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: diff --git a/web/modules/custom/edlp_agenda/src/Controller/AgendaController.php b/web/modules/custom/edlp_agenda/src/Controller/AgendaController.php index 8f5fc99fd..30c8c8f81 100644 --- a/web/modules/custom/edlp_agenda/src/Controller/AgendaController.php +++ b/web/modules/custom/edlp_agenda/src/Controller/AgendaController.php @@ -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(){ diff --git a/web/modules/custom/edlp_ajax/edlp_ajax.info.yml b/web/modules/custom/edlp_ajax/edlp_ajax.info.yml index abd774525..863df0a2c 100644 --- a/web/modules/custom/edlp_ajax/edlp_ajax.info.yml +++ b/web/modules/custom/edlp_ajax/edlp_ajax.info.yml @@ -7,5 +7,5 @@ name: Edlp Ajax type: module description: Manage ajax entity loading for edlp d8. -core: 8.x +core_version_requirement: ^8 || ^9 package: Edlp diff --git a/web/modules/custom/edlp_ajax/edlp_ajax.routing.yml b/web/modules/custom/edlp_ajax/edlp_ajax.routing.yml index 7768bb0cb..0be9a3b06 100644 --- a/web/modules/custom/edlp_ajax/edlp_ajax.routing.yml +++ b/web/modules/custom/edlp_ajax/edlp_ajax.routing.yml @@ -1,11 +1,3 @@ -# @Author: Bachir Soussi Chiadmi -# @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_ajax.entityjson: path: '/edlp/ajax/entity/json/{entity_type}/{id}/{viewmode}' defaults: diff --git a/web/modules/custom/edlp_ajax/src/Controller/EdlpAjaxController.php b/web/modules/custom/edlp_ajax/src/Controller/EdlpAjaxController.php index ff71453ff..0d1c4b82b 100644 --- a/web/modules/custom/edlp_ajax/src/Controller/EdlpAjaxController.php +++ b/web/modules/custom/edlp_ajax/src/Controller/EdlpAjaxController.php @@ -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' => [], diff --git a/web/modules/custom/edlp_corpus/edlp_corpus.info.yml b/web/modules/custom/edlp_corpus/edlp_corpus.info.yml index ac0e4fc7a..037b515cd 100644 --- a/web/modules/custom/edlp_corpus/edlp_corpus.info.yml +++ b/web/modules/custom/edlp_corpus/edlp_corpus.info.yml @@ -1,17 +1,5 @@ -# @Author: Bachir Soussi Chiadmi -# @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 Corpus type: module description: Creates interactive map of corpus for edlp d8. -core: 8.x +core_version_requirement: ^8 || ^9 package: Edlp -# dependencies: -# - migrate_drupal -# - migrate_plus -# - migrate_tools diff --git a/web/modules/custom/edlp_corpus/edlp_corpus.libraries.yml b/web/modules/custom/edlp_corpus/edlp_corpus.libraries.yml index 16d828b93..0a045546f 100644 --- a/web/modules/custom/edlp_corpus/edlp_corpus.libraries.yml +++ b/web/modules/custom/edlp_corpus/edlp_corpus.libraries.yml @@ -1,18 +1,8 @@ -# @Author: Bachir Soussi Chiadmi -# @Date: 20-12-2017 -# @Email: bachir@figureslibres.io -# @Filename: edlp_corpus.libraries.yml -# @Last modified by: bach -# @Last modified time: 20-12-2017 -# @License: GPL-V3 - corpus: - version: VERSION + version: 1.x css: base: assets/dist/styles/corpus.min.css: {} - - version: VERSION js: assets/dist/scripts/physics.min.js: { scope: footer } assets/dist/scripts/corpus.min.js: { scope: footer } diff --git a/web/modules/custom/edlp_corpus/edlp_corpus.module b/web/modules/custom/edlp_corpus/edlp_corpus.module index f841311e9..4dcb519e3 100644 --- a/web/modules/custom/edlp_corpus/edlp_corpus.module +++ b/web/modules/custom/edlp_corpus/edlp_corpus.module @@ -1,12 +1,4 @@ -# @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 - use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; use Drupal\Core\Url; @@ -98,13 +90,14 @@ function edlp_corpus_taxonomy_term_view(array &$build, EntityInterface $entity, $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node'); $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('type', 'enregistrement') ->sort('title') ->condition('field_entrees', $entity->id()); $documents_nids = $query->execute(); - $documents = entity_load_multiple('node', $documents_nids); + $documents = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($documents_nids); $documents_list = array ( '#theme' => 'item_list', @@ -149,13 +142,14 @@ function edlp_corpus_node_view(array &$build, EntityInterface $entity, EntityVie // querying all productions page that have this document in their entity reference "field_documents_liés" $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('type', 'page') // page (production) ->exists('field_page_type') ->condition('field_documents_lies.target_id', $entity->id(), 'IN'); $nids = $query->execute(); - $nodes = entity_load_multiple('node', $nids); + $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids); // dpm($nodes, '$nodes'); // build the array of relateds classified by page_type (taxonomy) @@ -163,7 +157,7 @@ function edlp_corpus_node_view(array &$build, EntityInterface $entity, EntityVie foreach ($nodes as $nid => $node) { // $page_type = $node->get('field_page_type')->get(0)->getValue(); // dpm($page_type, 'page_type'); - // $term = entity_load('taxonomy_term', $page_type['target_id']); + // $term = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->load($page_type['target_id']); // dpm($term, 'term'); // $relateds[$term->getName()][] = $node->getTitle(); $url = Url::fromRoute('entity.node.canonical', ['node'=>$node->id()]); @@ -230,10 +224,11 @@ function edlp_corpus_page_attachments(array &$attachments) { // get all entries $query = \Drupal::entityQuery('taxonomy_term') + ->accessCheck(TRUE) ->condition('vid', 'entrees'); $tids = $query->execute(); - $terms = entity_load_multiple('taxonomy_term', $tids); + $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($tids); $js_list = []; $css_str = ":root{\n"; diff --git a/web/modules/custom/edlp_corpus/edlp_corpus.routing.yml b/web/modules/custom/edlp_corpus/edlp_corpus.routing.yml index e7331dd82..ad0db3203 100644 --- a/web/modules/custom/edlp_corpus/edlp_corpus.routing.yml +++ b/web/modules/custom/edlp_corpus/edlp_corpus.routing.yml @@ -1,11 +1,3 @@ -# @Author: Bachir Soussi Chiadmi -# @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_corpus.corpusjson: path: '/edlp/corpus' defaults: diff --git a/web/modules/custom/edlp_corpus/src/Controller/CorpusController.php b/web/modules/custom/edlp_corpus/src/Controller/CorpusController.php index 13db93147..c9f236e81 100644 --- a/web/modules/custom/edlp_corpus/src/Controller/CorpusController.php +++ b/web/modules/custom/edlp_corpus/src/Controller/CorpusController.php @@ -32,18 +32,19 @@ class CorpusController extends ControllerBase { // @see https://chromatichq.com/blog/dependency-injection-drupal-8-plugins // Get a node storage object. - // $file_storage = \Drupal::entityManager()->getStorage('node'); + // $file_storage = \Drupal::entityTypeManager()->getStorage('node'); $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId(); $config = \Drupal::config('system.site'); $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('type', 'enregistrement'); $nids = $query->execute(); - $nodes = entity_load_multiple('node', $nids); + $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids); $view_builder = \Drupal::entityTypeManager()->getViewBuilder('node'); @@ -112,10 +113,11 @@ class CorpusController extends ControllerBase { } $query = \Drupal::entityQuery('taxonomy_term') + ->accessCheck(TRUE) ->condition('vid', 'entrees'); $tids = $query->execute(); - // $nodes = entity_load_multiple('node', $nids); + // $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids); foreach ($tids as $tid) { $entrees[] = $tid; } @@ -160,13 +162,14 @@ class CorpusController extends ControllerBase { // $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('type', 'enregistrement') ->sort('title', 'ASC'); // ->range(0,50); $nids = $query->execute(); - $nodes = entity_load_multiple('node', $nids); + $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids); // $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId(); @@ -285,13 +288,14 @@ class CorpusController extends ControllerBase { private function query() { $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('type', 'enregistrement') ->sort('created', 'DESC') ->range(0,50); $nids = $query->execute(); - $nodes = entity_load_multiple('node', $nids); + $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids); // $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId(); @@ -398,6 +402,7 @@ class CorpusController extends ControllerBase { private function articlesQuery() { $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('type', 'enregistrement') ->condition('body', '', "<>") @@ -405,7 +410,7 @@ class CorpusController extends ControllerBase { // ->range(0,20); $nids = $query->execute(); - $nodes = entity_load_multiple('node', $nids); + $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids); $current_langcode = \Drupal::languageManager()->getCurrentLanguage()->getId(); @@ -512,13 +517,14 @@ class CorpusController extends ControllerBase { $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $query = \Drupal::entityQuery('taxonomy_term') + ->accessCheck(TRUE) // ->sort('weight', 'DESC') // ->sort('name', 'DESC') ->condition('vid', 'entrees'); $tids = $query->execute(); - // $terms = entity_load_multiple('taxonomy_term', $tids); - // $terms = \Drupal::entityManager()->getStorage('taxonomy_term')->loadMultiple($t‌​erms); + // $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($tids); + // $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($t‌​erms); $terms = Term::loadMultiple($tids); $ordered_terms = []; diff --git a/web/modules/custom/edlp_corpus/src/Plugin/Block/BlockEntrees.php b/web/modules/custom/edlp_corpus/src/Plugin/Block/BlockEntrees.php index 957774832..1b7ba613b 100644 --- a/web/modules/custom/edlp_corpus/src/Plugin/Block/BlockEntrees.php +++ b/web/modules/custom/edlp_corpus/src/Plugin/Block/BlockEntrees.php @@ -28,13 +28,14 @@ class BlockEntrees extends BlockBase { $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $query = \Drupal::entityQuery('taxonomy_term') + ->accessCheck(TRUE) // ->sort('weight', 'DESC') // ->sort('name', 'DESC') ->condition('vid', 'entrees'); $tids = $query->execute(); - // $terms = entity_load_multiple('taxonomy_term', $tids); - // $terms = \Drupal::entityManager()->getStorage('taxonomy_term')->loadMultiple($t‌​erms); + // $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($tids); + // $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($t‌​erms); $terms = Term::loadMultiple($tids); $ordered_terms = []; diff --git a/web/modules/custom/edlp_corpus/src/Plugin/Filter/AudioLinksFilter.php b/web/modules/custom/edlp_corpus/src/Plugin/Filter/AudioLinksFilter.php index c440e5ab4..bbd4f3a7c 100644 --- a/web/modules/custom/edlp_corpus/src/Plugin/Filter/AudioLinksFilter.php +++ b/web/modules/custom/edlp_corpus/src/Plugin/Filter/AudioLinksFilter.php @@ -34,7 +34,7 @@ class AudioLinksFilter extends FilterBase { $href = $link->getAttribute('href'); preg_match('/^\/?node\/(\d+)$/', $href, $matches); // dpm($matches[1]); - $node = entity_load('node', $matches[1]); + $node = \Drupal::entityTypeManager()->getStorage('node')->load($matches[1]); if(!$node) continue; if($node->getType() != "enregistrement") continue; diff --git a/web/modules/custom/edlp_fils/edlp_fils.info.yml b/web/modules/custom/edlp_fils/edlp_fils.info.yml index 3d824fb1b..4ef86e289 100644 --- a/web/modules/custom/edlp_fils/edlp_fils.info.yml +++ b/web/modules/custom/edlp_fils/edlp_fils.info.yml @@ -10,5 +10,5 @@ name: Edlp Fils type: module description: Manage fils for edlp d8. -core: 8.x +core_version_requirement: ^8 || ^9 package: Edlp diff --git a/web/modules/custom/edlp_home/edlp_home.info.yml b/web/modules/custom/edlp_home/edlp_home.info.yml index b53672342..a5493f196 100644 --- a/web/modules/custom/edlp_home/edlp_home.info.yml +++ b/web/modules/custom/edlp_home/edlp_home.info.yml @@ -10,7 +10,7 @@ name: Edlp Home type: module description: Manage home for edlp d8. -core: 8.x +core_version_requirement: ^8 || ^9 package: Edlp # dependencies: # - migrate_drupal diff --git a/web/modules/custom/edlp_home/src/Controller/HomeController.php b/web/modules/custom/edlp_home/src/Controller/HomeController.php index d40082d00..cc86d0dda 100644 --- a/web/modules/custom/edlp_home/src/Controller/HomeController.php +++ b/web/modules/custom/edlp_home/src/Controller/HomeController.php @@ -4,6 +4,7 @@ namespace Drupal\edlp_home\Controller; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Datetime\DrupalDateTime; +use Drupal\datetime\Plugin\Field\FieldType\DateTimeItemInterface; use Drupal\taxonomy\Entity\Term; use Drupal\workflow\Entity\WorkflowManager; use Drupal\Core\Url; @@ -30,45 +31,50 @@ class HomeController extends ControllerBase { // first get static pages $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('field_afficher_en_page_d_acceuil', 1) ->condition('type', 'static'); $promoted_nids = $query->execute(); - $contents["#promoted_statics"] = entity_load_multiple('node', $promoted_nids); + $contents["#promoted_statics"] = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($promoted_nids); // then get production pages $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('field_afficher_en_page_d_acceuil', 1) ->condition('type', 'page'); $promoted_nids = $query->execute(); - $contents["#promoted_prods"] = entity_load_multiple('node', $promoted_nids); + $contents["#promoted_prods"] = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($promoted_nids); // presentation // $query = \Drupal::entityQuery('node') + // ->accessCheck(TRUE) // ->condition('status', 1) // ->condition('nid', 12242); // // TODO: présentation nid should be a setting // // $pres_nid = $query->execute(); - // $contents["#presentation_node"] = entity_load('node', array_pop($pres_nid)); + // $contents["#presentation_node"] = \Drupal::entityTypeManager()->getStorage('node')->load(array_pop($pres_nid)); // last fil // $query = \Drupal::entityQuery('node') + // ->accessCheck(TRUE) // ->condition('status', 1) // ->condition('type', 'fil') // ->sort('created', 'DESC') // ->range(0,1); // // $fil = $query->execute(); - // $contents["#last_fil_node"] = entity_load('node', array_pop($fil)); + // $contents["#last_fil_node"] = \Drupal::entityTypeManager()->getStorage('node')->load(array_pop($fil)); // $contents["#last_fil_node"] = array('#markup'=>'En développement.'); // last production // $query = \Drupal::entityQuery('node') + // ->accessCheck(TRUE) // ->condition('status', 1) // ->condition('type', 'page') // ->condition('field_page_type', array('1168'), 'NOT IN') @@ -76,17 +82,18 @@ class HomeController extends ControllerBase { // ->range(0,1); // // $prod = $query->execute(); - // $contents["#last_production_node"] = entity_load('node', array_pop($prod)); + // $contents["#last_production_node"] = \Drupal::entityTypeManager()->getStorage('node')->load(array_pop($prod)); // last documents $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('type', 'enregistrement') ->sort('created', 'DESC') ->range(0,50); $nids = $query->execute(); - $nodes = entity_load_multiple('node', $nids); + $nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids); $lastdocs = []; $i = 0; @@ -98,23 +105,24 @@ class HomeController extends ControllerBase { $i++; if($i>9) break; } - // $contents["#lastdocs_items"] = entity_load_multiple('node', $lastdocs); + // $contents["#lastdocs_items"] = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($lastdocs); $contents["#lastdocs_items"] = $lastdocs; // dsm($contents["#lastdocs_items"], "#lastdocs_items"); // agenda $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), '>=') ->range(0,5) ->sort('field_date'); $events = $query->execute(); - $contents['#agenda_items'] = entity_load_multiple('node', $events); + $contents['#agenda_items'] = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($events); return $contents; } @@ -132,46 +140,50 @@ class HomeController extends ControllerBase { // first get static pages $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('field_afficher_en_page_d_acceuil', 1) ->condition('type', 'static'); $promoted_nids = $query->execute(); - $renderable["#promoted_statics"] = entity_load_multiple('node', $promoted_nids); + $renderable["#promoted_statics"] = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($promoted_nids); // then get production pages $query = \Drupal::entityQuery('node') + ->accessCheck(TRUE) ->condition('status', 1) ->condition('field_afficher_en_page_d_acceuil', 1) ->condition('type', 'page'); $promoted_nids = $query->execute(); - $renderable["#promoted_prods"] = entity_load_multiple('node', $promoted_nids); + $renderable["#promoted_prods"] = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($promoted_nids); // last fil // $query = \Drupal::entityQuery('node') + // ->accessCheck(TRUE) // ->condition('status', 1) // ->condition('type', 'fil') // ->sort('created', 'DESC') // ->range(0,1); // // $fil = $query->execute(); - // $renderable["#last_fil_node"] = entity_load('node', array_pop($fil)); + // $renderable["#last_fil_node"] = \Drupal::entityTypeManager()->getStorage('node')->load(array_pop($fil)); // $renderable["#last_fil_node"] = array('#markup'=>'En développement.'); // agenda /* $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), '>=') ->range(0,5) ->sort('field_date'); $events = $query->execute(); - $renderable['#agenda_items'] = entity_load_multiple('node', $events); + $renderable['#agenda_items'] = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($events); */ // Collection diff --git a/web/modules/custom/edlp_migrate/edlp_migrate.info.yml b/web/modules/custom/edlp_migrate/edlp_migrate.info.yml index a60427064..29f129119 100644 --- a/web/modules/custom/edlp_migrate/edlp_migrate.info.yml +++ b/web/modules/custom/edlp_migrate/edlp_migrate.info.yml @@ -1,7 +1,7 @@ name: Edlp migration type: module description: Defines custom migration for edlp (from d6 to d8). -core: 8.x +core_version_requirement: ^8 || ^9 package: Edlp dependencies: - migrate_drupal diff --git a/web/modules/custom/edlp_mobile/edlp_mobile.info.yml b/web/modules/custom/edlp_mobile/edlp_mobile.info.yml index 773194c9e..9b72cb55d 100644 --- a/web/modules/custom/edlp_mobile/edlp_mobile.info.yml +++ b/web/modules/custom/edlp_mobile/edlp_mobile.info.yml @@ -1,7 +1,7 @@ name: 'edlp_mobile' type: module description: 'Handle some mobile behaviours' -core: 8.x +core_version_requirement: ^8 || ^9 package: 'Edlp' dependencies: - domain diff --git a/web/modules/custom/edlp_productions/edlp_productions.info.yml b/web/modules/custom/edlp_productions/edlp_productions.info.yml index 9a8485e1f..c7c915557 100644 --- a/web/modules/custom/edlp_productions/edlp_productions.info.yml +++ b/web/modules/custom/edlp_productions/edlp_productions.info.yml @@ -10,7 +10,7 @@ name: Edlp Productions type: module description: Manage productions for edlp d8. -core: 8.x +core_version_requirement: ^8 || ^9 package: Edlp # dependencies: # - migrate_drupal diff --git a/web/modules/custom/edlp_productions/edlp_productions.routing.yml b/web/modules/custom/edlp_productions/edlp_productions.routing.yml index 01cfc0068..c7160b88d 100644 --- a/web/modules/custom/edlp_productions/edlp_productions.routing.yml +++ b/web/modules/custom/edlp_productions/edlp_productions.routing.yml @@ -1,11 +1,3 @@ -# @Author: Bachir Soussi Chiadmi -# @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_productions.productions: path: '/productions' defaults: diff --git a/web/modules/custom/edlp_productions/src/Controller/ProductionsController.php b/web/modules/custom/edlp_productions/src/Controller/ProductionsController.php index 82db0f144..ef225c2db 100644 --- a/web/modules/custom/edlp_productions/src/Controller/ProductionsController.php +++ b/web/modules/custom/edlp_productions/src/Controller/ProductionsController.php @@ -21,6 +21,7 @@ class ProductionsController extends ControllerBase { $menu_name = 'productions'; $query = \Drupal::entityQuery('menu_link_content') + ->accessCheck(TRUE) ->condition('menu_name', $menu_name) ->condition('enabled', 1) ->sort('weight', 'ASC'); @@ -43,7 +44,7 @@ class ProductionsController extends ControllerBase { $nids[] = ($m[2]); } - $this->nodes = entity_load_multiple('node', $nids); + $this->nodes = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($nids); } diff --git a/web/modules/custom/edlp_search/edlp_search.info.yml b/web/modules/custom/edlp_search/edlp_search.info.yml index 67c31c286..43b0d9ffd 100644 --- a/web/modules/custom/edlp_search/edlp_search.info.yml +++ b/web/modules/custom/edlp_search/edlp_search.info.yml @@ -1,7 +1,7 @@ name: 'edlp_search' type: module description: 'Edlp search module' -core: 8.x +core_version_requirement: ^8 || ^9 package: Edlp dependencies: - search_api diff --git a/web/modules/custom/edlp_search/src/Controller/EdlpSearchController.php b/web/modules/custom/edlp_search/src/Controller/EdlpSearchController.php index 9aa69ec39..ce9e36739 100644 --- a/web/modules/custom/edlp_search/src/Controller/EdlpSearchController.php +++ b/web/modules/custom/edlp_search/src/Controller/EdlpSearchController.php @@ -350,7 +350,7 @@ class EdlpSearchController extends ControllerBase { // entries $this->entry_names = []; if (!empty($this->entries)){ - $terms = entity_load_multiple('taxonomy_term', $this->entries); + $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($this->entries); $entries_condition_group = $query->createConditionGroup(); foreach ($terms as $tid => $term) { $entries_condition_group->addCondition('field_entrees', (int)$tid, "="); diff --git a/web/modules/custom/edlp_search/src/Form/EdlpSearchForm.php b/web/modules/custom/edlp_search/src/Form/EdlpSearchForm.php index ebda363fa..be555819e 100644 --- a/web/modules/custom/edlp_search/src/Form/EdlpSearchForm.php +++ b/web/modules/custom/edlp_search/src/Form/EdlpSearchForm.php @@ -84,10 +84,11 @@ class EdlpSearchForm extends FormBase { private function getEntries(){ $query = \Drupal::entityQuery('taxonomy_term') + ->accessCheck(TRUE) ->condition('vid', 'entrees'); $tids = $query->execute(); - $terms = entity_load_multiple('taxonomy_term', $tids); + $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($tids); // dsm($terms); foreach ($terms as $term) { // dpm($term->toArray()); @@ -122,7 +123,7 @@ class EdlpSearchForm extends FormBase { public function submitForm(array &$form, FormStateInterface $form_state) { // Display result. foreach ($form_state->getValues() as $key => $value) { - drupal_set_message($key . ': ' . $value); + \Drupal::messenger()->addMessage($key . ': ' . $value); } } diff --git a/web/modules/custom/edlp_studio/edlp_studio.info.yml b/web/modules/custom/edlp_studio/edlp_studio.info.yml index d3c1f600d..df709ae62 100644 --- a/web/modules/custom/edlp_studio/edlp_studio.info.yml +++ b/web/modules/custom/edlp_studio/edlp_studio.info.yml @@ -1,7 +1,7 @@ name: 'Edlp Studio' type: module description: 'Edlp module that handle chutier and Compositions entities' -core: 8.x +core_version_requirement: ^8 || ^9 package: Edlp dependencies: - entity_reference diff --git a/web/modules/custom/edlp_studio/edlp_studio.libraries.yml b/web/modules/custom/edlp_studio/edlp_studio.libraries.yml index 6318c478f..1e83f9c32 100644 --- a/web/modules/custom/edlp_studio/edlp_studio.libraries.yml +++ b/web/modules/custom/edlp_studio/edlp_studio.libraries.yml @@ -5,6 +5,6 @@ edlp_studio-library: - core/drupalSettings - core/jquery - core/jquery.once - - core/jquery.ui.draggable - - core/jquery.ui.droppable - - core/jquery.ui.sortable + - jquery_ui_draggable/jquery_ui_draggable + - jquery_ui_droppable/jquery_ui_droppable + - jquery_ui_sortable/jquery_ui_sortable diff --git a/web/modules/custom/edlp_studio/src/Controller/ChutierController.php b/web/modules/custom/edlp_studio/src/Controller/ChutierController.php index 9a0ee629d..c5f124a87 100644 --- a/web/modules/custom/edlp_studio/src/Controller/ChutierController.php +++ b/web/modules/custom/edlp_studio/src/Controller/ChutierController.php @@ -121,7 +121,7 @@ class ChutierController extends ControllerBase { } private function validateNewDoc($id){ - $node = entity_load('node', $id); + $node = \Drupal::entityTypeManager()->getStorage('node')->load($id); if($node){ // TODO: get node bundle by settings (@see readme) if($node->getType() == 'enregistrement'){ @@ -149,7 +149,7 @@ class ChutierController extends ControllerBase { private function checkChutier(){ $default_chutier_id = $this->userdata->get('edlp_studio', $this->user->id(), 'default_chutier'); // dpm($this->default_chutier_id); - $this->chutier = entity_load('chutier', $default_chutier_id); + $this->chutier = \Drupal::entityTypeManager()->getStorage('chutier')->load($default_chutier_id); // if default chutier does not exists, create, save and record it if(!$this->chutier){ $this->createDefaultChutier(); @@ -169,7 +169,7 @@ class ChutierController extends ControllerBase { 'status' => TRUE, 'name' => t('Default'), ); - $this->chutier = entity_create('chutier', $chutier); + $this->chutier = \Drupal::entityTypeManager()->getStorage('chutier')->create($chutier); $this->chutier->save(); } diff --git a/web/modules/custom/edlp_studio/src/Controller/CompositionController.php b/web/modules/custom/edlp_studio/src/Controller/CompositionController.php index 8b7420d8f..faf928279 100644 --- a/web/modules/custom/edlp_studio/src/Controller/CompositionController.php +++ b/web/modules/custom/edlp_studio/src/Controller/CompositionController.php @@ -170,7 +170,7 @@ class CompositionController extends ControllerBase { 'status' => TRUE, 'name' => $name, ); - $this->compo = entity_create('composition', $compo); + $this->compo = \Drupal::entityTypeManager()->getStorage('composition')->create($compo); $this->compo->save(); } @@ -181,11 +181,11 @@ class CompositionController extends ControllerBase { } private function openComposition($cid){ - $this->compo = entity_load('composition', $cid); + $this->compo = \Drupal::entityTypeManager()->getStorage('composition')->load($cid); } private function saveComposition($cid, $name = "", $new_documents = array()){ - $this->compo = entity_load('composition', $cid); + $this->compo = \Drupal::entityTypeManager()->getStorage('composition')->load($cid); if($name != ""){ $this->compo->setName($name); } @@ -201,7 +201,7 @@ class CompositionController extends ControllerBase { private function deleteComposition($cid){ - $this->compo = entity_load('composition', $cid); + $this->compo = \Drupal::entityTypeManager()->getStorage('composition')->load($cid); $this->compo->delete(); } } diff --git a/web/modules/custom/edlp_studio/src/Controller/StudioUIController.php b/web/modules/custom/edlp_studio/src/Controller/StudioUIController.php index d069b8db3..305d502cf 100644 --- a/web/modules/custom/edlp_studio/src/Controller/StudioUIController.php +++ b/web/modules/custom/edlp_studio/src/Controller/StudioUIController.php @@ -115,7 +115,7 @@ class StudioUIController extends ControllerBase { $documents_nids = Chutier::getUserChutiersContents($this->user->id()); // dpm($documents_nids); - $documents = entity_load_multiple('node', $documents_nids); + $documents = \Drupal::entityTypeManager()->getStorage('node')->loadMultiple($documents_nids); // build content renderable array $chutier_ui = array( @@ -153,6 +153,7 @@ class StudioUIController extends ControllerBase { private function buildCompostionsList(){ // get compositions $query = \Drupal::entityQuery('composition') + ->accessCheck(TRUE) ->condition('user_id', $this->user->id()); $compos_ids = $query->execute(); @@ -160,7 +161,7 @@ class StudioUIController extends ControllerBase { if(!count($compos_ids)){ // create default compos - $def_compos = \Drupal::entityManager() + $def_compos = \Drupal::entityTypeManager() ->getStorage('composition') ->create(array( 'name' => 'composition', @@ -171,7 +172,7 @@ class StudioUIController extends ControllerBase { $compos_ids = array($def_compos->id()); } - $compos = entity_load_multiple('composition', $compos_ids); + $compos = \Drupal::entityTypeManager()->getStorage('composition')->loadMultiple($compos_ids); $createurl = Url::fromRoute('edlp_studio.composition_controller_action_ajax', ['action' => 'create'], ['absolute' => TRUE]); @@ -185,13 +186,14 @@ class StudioUIController extends ControllerBase { private function getLastCompo(){ // just get the last compositions $query = \Drupal::entityQuery('composition') + ->accessCheck(TRUE) ->condition('user_id', $this->user->id()) ->range(0,1) ->sort('created', 'DESC'); $compos_id = $query->execute(); if(count($compos_id)){ - $lastcompo = entity_load('composition', array_pop($compos_id)); + $lastcompo = \Drupal::entityTypeManager()->getStorage('composition')->load(array_pop($compos_id)); }else{ $lastcompo = null; } diff --git a/web/modules/custom/edlp_studio/src/Entity/Chutier.php b/web/modules/custom/edlp_studio/src/Entity/Chutier.php index 30d4b03e3..ce5b2e592 100644 --- a/web/modules/custom/edlp_studio/src/Entity/Chutier.php +++ b/web/modules/custom/edlp_studio/src/Entity/Chutier.php @@ -247,10 +247,11 @@ class Chutier extends ContentEntityBase implements ChutierInterface { public static function getUserChutiersContents($uid){ // TODO: use query if we use more than one chutier // $query = \Drupal::entityQuery('chutier') + // ->accessCheck(TRUE) // ->condition('user_id', $uid); // // $chutiers_nids = $query->execute(); - // $chutiers = entity_load_multiple('chutier', $chutiers_nids); + // $chutiers = \Drupal::entityTypeManager()->getStorage('chutier')->loadMultiple($chutiers_nids); // // $contents = array(); // foreach ($chutiers as $id => $chutier) { @@ -260,7 +261,7 @@ class Chutier extends ContentEntityBase implements ChutierInterface { /** @var UserDataInterface $userData */ $userData = \Drupal::service('user.data'); $default_chutier_id = $userData->get('edlp_studio', $uid, 'default_chutier'); - if($chutier = entity_load('chutier', $default_chutier_id)){ + if($chutier = \Drupal::entityTypeManager()->getStorage('chutier')->load($default_chutier_id)){ return array_column($chutier->documents->getValue(), 'target_id'); }else{ return array(); diff --git a/web/modules/custom/edlp_studio/src/Form/ChutierForm.php b/web/modules/custom/edlp_studio/src/Form/ChutierForm.php index c8e87447b..30813f970 100644 --- a/web/modules/custom/edlp_studio/src/Form/ChutierForm.php +++ b/web/modules/custom/edlp_studio/src/Form/ChutierForm.php @@ -34,13 +34,13 @@ class ChutierForm extends ContentEntityForm { switch ($status) { case SAVED_NEW: - drupal_set_message($this->t('Created the %label Chutier.', [ + \Drupal::messenger()->addMessage($this->t('Created the %label Chutier.', [ '%label' => $entity->label(), ])); break; default: - drupal_set_message($this->t('Saved the %label Chutier.', [ + \Drupal::messenger()->addMessage($this->t('Saved the %label Chutier.', [ '%label' => $entity->label(), ])); } diff --git a/web/modules/custom/edlp_studio/src/Form/CompositionForm.php b/web/modules/custom/edlp_studio/src/Form/CompositionForm.php index 8fd4462aa..d5bc97228 100644 --- a/web/modules/custom/edlp_studio/src/Form/CompositionForm.php +++ b/web/modules/custom/edlp_studio/src/Form/CompositionForm.php @@ -34,13 +34,13 @@ class CompositionForm extends ContentEntityForm { switch ($status) { case SAVED_NEW: - drupal_set_message($this->t('Created the %label Composition.', [ + \Drupal::messenger()->addMessage($this->t('Created the %label Composition.', [ '%label' => $entity->label(), ])); break; default: - drupal_set_message($this->t('Saved the %label Composition.', [ + \Drupal::messenger()->addMessage($this->t('Saved the %label Composition.', [ '%label' => $entity->label(), ])); } diff --git a/web/themes/custom/edlptheme/edlptheme.info.yml b/web/themes/custom/edlptheme/edlptheme.info.yml index 53d255d70..9177da329 100644 --- a/web/themes/custom/edlptheme/edlptheme.info.yml +++ b/web/themes/custom/edlptheme/edlptheme.info.yml @@ -2,7 +2,7 @@ name: edlp description: 'EDLP Drupal 8 theme with gulp' type: theme base theme: classy -core: 8.x +core_version_requirement: ^8 || ^9 libraries: - core/normalize - edlptheme/redirect-js