Snippets -> https://www.drupal.org/documentation/customization/snippets
A beginner's guide to using snippets -> https://www.drupal.org/node/337959
Drupal Commerce 2 Snippets -> https://gist.github.com/jakubhnilicka/00ed4492fea86571ab88a68d0e7a2158
https://gist.github.com/BBGuy/c362a30bb0dda65777b076040b14cab5
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 | |
/** | |
* Set redis configuration. | |
*/ | |
/** @see: https://docs.platform.sh/frameworks/drupal8/redis.html */ | |
if (extension_loaded('redis')) { | |
// Set Redis as the default backend for any cache bin not otherwise specified. | |
// $settings['cache']['default'] = 'cache.backend.redis'; |
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
gunzip -c database.sql.gz | drush sqlc |
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 | |
// Import arbitrary config from a variable. | |
// Assumes $data has the data you want to import for this config. | |
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html'); | |
$config->setData($data)->save(); | |
// Or, re-import the default config for a module or profile, etc. | |
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module'); |
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
/** | |
* Helper function for adding translations. | |
* | |
* @param array $strings | |
* The array with strings and their translations. | |
*/ | |
function _my_module_add_translations(array $strings) { | |
// Get locale storage service. | |
$storage = \Drupal::service('locale.storage'); |
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
docker tag 105_mariadb docker.io/keopx/mariadb:10.5 | |
docker push keopx/mariadb:10.5 |
Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.
cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
cp ~/.gnupg/trustdb.gpg /path/to/backups/
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 | |
/* | |
Make Sure you include: | |
ctools_include('modal'); | |
ctools_modal_add_js(); | |
On the pages you put your link. | |
*/ |
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
Reworked the script to use XML instead. This works a lot better. I do have to edit the XML file to remove some invalid characters such as EOL characters which end up in the XML file. | |
If you install PHP CodeSniffer and the ruleset using the instructions from #10, you can then generate the coding standards report with: | |
$ ./modules/coder/vendor/bin/phpcs --standard=phpcs.xml --extensions=css,inc,info,install,js,module,php,profile,test,theme --ignore=core/vendor,core/assets/vendor --report=xml core/ > report.xml | |
You'll need to edit the XML to remove a couple of illegal characters, then finally generate the phpcs.xml file: | |
$ ./phpcs-generate.php report.xml > phpcs.xml |
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
String pro_domain = '2017.drupalcamp.es' | |
String dev_domain = 'dev.drupalcamp.es' | |
String drush_pro = "drush -l ${pro_domain} -r /var/www/${pro_domain}/current/web" | |
String drush_dev = "drush -l ${dev_domain} -r /var/www/${dev_domain}/current/web" | |
String files_pro = "/var/www/${pro_domain}/shared/web/sites/default/files/" | |
String files_dev = "/var/www/${dev_domain}/shared/web/sites/default/files/" | |
String rsyncOpts = '-azv --delete --exclude .php --exclude php --exclude styles' | |
String deploySshKeyId = 'some-key-id' | |
lock(resource: "dev.drupalcamp.es") { |
NewerOlder