Skip to content

Instantly share code, notes, and snippets.

@mikeshiyan
mikeshiyan / .lando.yml
Last active December 19, 2023 13:33
Landofile for running PHPUnit and Nightwatch JS tests in a local Drupal repo (any branch).
name: drupal-test
recipe: drupal9
config:
webroot: .
php: 8.1
services:
appserver:
build_as_root:
# Install nodejs and yarn in the main container. They have to live here
# because PHP is required for the site installation and other ops in
@leahtard
leahtard / HOOK_theme_suggestions_block_alter
Last active July 12, 2018 15:41
Create TWIG template suggestions for Drupal 8 custom block types. Enables block--custom-block-type.html.twig
function basic_theme_suggestions_block_alter(array &$suggestions, array $variables) {
$block = $variables['elements'];
$blockType = $block['#configuration']['provider'];
if ($blockType == "block_content") {
$bundle = $block['content']['#block_content']->bundle();
$suggestions[] = 'block__' . $bundle;
}