Skip to content

Instantly share code, notes, and snippets.

View lcube45's full-sized avatar
🏌️‍♂️
Focusing

lcube lcube45

🏌️‍♂️
Focusing
View GitHub Profile
@lcube45
lcube45 / gist:ea5b47477e19cd9ddceb2a8f73b07a56
Created January 26, 2021 15:46
Drupal 9 - update drupal core
composer show drupal/core-recommended
composer outdated 'drupal/*'
composer update drupal/core 'drupal/core-*' --with-all-dependencies
@lcube45
lcube45 / gist:958f3326c3f075b7bbc29a9cf7c6904a
Created October 6, 2020 15:20
Update package composer-drupal-optimizations
composer update zaporylie/composer-drupal-optimizations --no-plugins && composer update --lock
@lcube45
lcube45 / README.MD
Created June 1, 2020 15:24
Drupal 8 et Composer
@lcube45
lcube45 / gist:9140114156486609dd5ee0118f5e7adb
Last active June 1, 2020 15:03
Drupal 8 - update core 8.8.1->8.8.2
composer update drupal/core --with-dependencies
@lcube45
lcube45 / mymodule.php
Created June 1, 2020 14:57
Drupal 8 - BaseFieldDefinition - entity_reference_revisions
<?php
// si limitation sur les bundles de paragraphes: renseigner target_bundles
// ajout du widget de paragraphs "classic paragraphs
$fields['paragraphs'] = BaseFieldDefinition::create('entity_reference_revisions')
->setLabel('Paragraphs')
->setDescription('Paragraphs')
->setCardinality(FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED)
->setRequired(TRUE)
@lcube45
lcube45 / mymodule.php
Created June 1, 2020 14:56
Drupal 8 - hook update - installEntityType/uninstallEntityType
<?php
/**
* Update- Create your_entity_name entity.
*/
function my_module_update_8001() {
//check if the table exists first. If not, then create the entity.
if(!db_table_exists('your_entity_name')) {
\Drupal::entityTypeManager()->clearCachedDefinitions();
\Drupal::entityDefinitionUpdateManager()
@lcube45
lcube45 / MyTextFilter.php
Last active June 1, 2020 14:55
Drupal 8 - créer un filtre de texte personnalisé
<?php
namespace Drupal\my_module\Plugin\Filter;
use Drupal\Component\Utility\Html;
use Drupal\filter\FilterProcessResult;
use Drupal\filter\Plugin\FilterBase;
/**
* Makes the tables in the content show up using Bootstrap styling.
@lcube45
lcube45 / gist:b634852c51ec100be64433a211e34e3a
Created June 1, 2020 14:54
Drupal 8 - récupérer l'arborescence des termes
<?php
namespace Drupal\mon_module\Tools
use Drupal\taxonomy\Entity\Term;
/**
* Service de récupération d'arborescence de termes
*
* @package Drupal\mon_module\Tools
@lcube45
lcube45 / gist:e1bcfb9392392a09c13e593a1f598380
Created June 1, 2020 14:53
Drupal 8 - composer download a specific module version
Specifying a version you can specify a version from the command line with:
composer require drupal/<modulename>:<version>
For example:
composer require drupal/ctools:3.0.0-alpha26
composer require drupal/token:1.x-dev
@lcube45
lcube45 / gist:64532c7773d20d3bbfeb24e5995a29b4
Created June 1, 2020 14:52
Drupal - fix missing module message error
# https://www.drupal.org/node/2487215
drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='module_name';"