updated custom modules codes for d9

This commit is contained in:
2024-09-16 21:48:07 +02:00
parent b357237047
commit cbac2d9946
38 changed files with 375 additions and 158 deletions
+3
View File
@@ -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",
Generated
+256
View File
@@ -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",
+4
View File
@@ -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
@@ -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
@@ -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(){
@@ -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
@@ -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_ajax.entityjson:
path: '/edlp/ajax/entity/json/{entity_type}/{id}/{viewmode}'
defaults:
@@ -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' => [],
@@ -1,17 +1,5 @@
# @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 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
@@ -1,18 +1,8 @@
# @Author: Bachir Soussi Chiadmi <bach>
# @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 }
@@ -1,12 +1,4 @@
<?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
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";
@@ -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_corpus.corpusjson:
path: '/edlp/corpus'
defaults:
@@ -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($terms);
// $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($tids);
// $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($terms);
$terms = Term::loadMultiple($tids);
$ordered_terms = [];
@@ -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($terms);
// $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($tids);
// $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadMultiple($terms);
$terms = Term::loadMultiple($tids);
$ordered_terms = [];
@@ -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;
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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_productions.productions:
path: '/productions'
defaults:
@@ -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);
}
@@ -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
@@ -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, "=");
@@ -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);
}
}
@@ -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
@@ -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
@@ -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();
}
@@ -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();
}
}
@@ -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;
}
@@ -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();
@@ -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(),
]));
}
@@ -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(),
]));
}
@@ -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