This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grumphp: | |
tasks: | |
git_blacklist_twig: | |
metadata: | |
task: git_blacklist | |
keywords: | |
- "dump(" | |
- "kint(" | |
- "|raw" | |
- "autoescape" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_module\Plugin\Field\FieldFormatter; | |
use Drupal\Core\Field\FieldItemListInterface; | |
use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
use Drupal\responsive_image\Plugin\Field\FieldFormatter\ResponsiveImageFormatter as ResponsiveImageFormatterCore; | |
/** | |
* Responsive image formatter that allow to force the format. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// src/Plugin/migrate/source/Spreadsheet.php | |
namespace Drupal\my_project\Plugin\migrate\source; | |
use Drupal\my_project\SpreadsheetIterator; | |
use Drupal\migrate\MigrateException; | |
use Drupal\migrate\Plugin\MigrationInterface; | |
use Drupal\migrate_spreadsheet\Plugin\migrate\source\Spreadsheet as SpreadsheetContrib; | |
use PhpOffice\PhpSpreadsheet\IOFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Return error codes if they happen. | |
set -e | |
# Working directory. | |
# Helper to let you run the install script from anywhere. | |
currentscriptpath () { | |
SOURCE="${BASH_SOURCE[0]}" | |
# resolve $SOURCE until the file is no longer a symlink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\hc_core\Plugin\search_api\processor; | |
use Drupal\node\Entity\Node; | |
use Drupal\search_api\Datasource\DatasourceInterface; | |
use Drupal\search_api\IndexInterface; | |
use Drupal\search_api\Item\ItemInterface; | |
use Drupal\search_api\Processor\ProcessorPluginBase; | |
use Drupal\search_api\Processor\ProcessorProperty; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# How to use this script? | |
# | |
# 1. create an empty module that depends on default_content or reuse an | |
# existing one. | |
# 2. use `drush dcer --folder=path/to/module/content ENTITY_TYPE ID` | |
# to add default content to your module. | |
# 3. once all your content is in your module, clean up the content folder | |
# to only keep the content you need (ie. remove users most of the time). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($, Drupal) { | |
'use strict'; | |
/** | |
* Handle click on a node so it redirects to the location of its first link. | |
*/ | |
Drupal.behaviors.clickableNode = { | |
attach: function (context, settings) { | |
$('.js-clickable-node').once('clickableNode') | |
.on('mouseup.clickableNode', function (evt) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\webform\Entity\Webform; | |
/** | |
* Implements hook_entity_extra_field_info(). | |
*/ | |
function MY_MODULE_entity_extra_field_info() { | |
$extra['paragraph']['PARAGRAPH_TYPE']['display']['FIELD_NAME'] = [ | |
'label' => t('Form'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BASEDIR=vendor/bin/drush | |
if [ ! -f $BASEDIR ]; then | |
BASEDIR=../$BASEDIR | |
fi | |
$BASEDIR $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Enable language module, delete english and set french as default. | |
*/ | |
function my_module_update_N() { | |
\Drupal::service('module_installer')->install(['language']); | |
// Enable french language and set it as default. | |
if (NULL === ConfigurableLanguage::load('fr')) { | |
ConfigurableLanguage::create([ | |
'id' => 'fr', |
NewerOlder