Skip to content

Instantly share code, notes, and snippets.

# How to force disable interface translation by overriding the locale lookup service to not be added to the translation manager
# settings.local.php:
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/default/services.local.yml';
# services.local.yml (add this file to .gitignore):
services:
string_translator.locale.lookup:
class: Drupal\locale\LocaleTranslation
@ralphschindler
ralphschindler / README.md
Last active May 1, 2024 19:14
Docker For Mac Host Address Alias To Enable PHP XDebug (10.254.254.254 Trick)

Docker (Mac) De-facto Standard Host Address Alias

This launchd script will ensure that your Docker environment on your Mac will have 10.254.254.254 as an alias on your loopback device (127.0.0.1). The command being run is ifconfig lo0 alias 10.254.254.254.

Once your machine has a well known IP address, your PHP container will then be able to connect to it, specifically XDebug can connect to it at the configured xdebug.remote_host.

Installation Of IP Alias (This survives reboot)

Copy/Paste the following in terminal with sudo (must be root as the target directory is owned by root)...

@esolitos
esolitos / OUTDATED # Drupal + RamsaltMedia Settings
Last active February 19, 2020 13:46
OUTDATED # Devel settings for Drupal + RamsaltMedia platforms - MOVED to https://github.com/esolitos/drupal-utility
This config assumes that:
- `platform.settings.php` is placed in the `sites/` directory
- you have a `sites/files` directory in your drupal installation.
- you have a `ramsalt` user that can access all your databases starting with `ramsalt_`
- the files on the "live" site are placed in the drupal's default directory: `sites/hostname.tld/files`
@makbeta
makbeta / ckeditor.styles.js
Last active August 29, 2015 14:04
Creating custom classes in CKEditor in Drupal
if(typeof(CKEDITOR) !== 'undefined') {
CKEDITOR.stylesSet.add( 'drupal', [
// Block-level styles
{ name: 'Float Left', element: 'p', attributes: { 'class': 'left'} },
{ name: 'Float Right' , element: 'p', attributes: { 'class': 'right'} },
// Inline styles
{ name: 'Small Text', element: 'small' }
] );
@pbuyle
pbuyle / FeatureContext.php
Last active January 25, 2024 23:25
Behat step-definition to verify visibility (not just presence) of Drupal form elements.
<?php
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
/**