Skip to content

Instantly share code, notes, and snippets.

View mogtofu33's full-sized avatar

Jean Valverde mogtofu33

View GitHub Profile
@mogtofu33
mogtofu33 / drupal_8_twig_cheatsheet.md
Created July 29, 2020 17:10 — forked from raphaellarrinaga/drupal_8_twig_cheatsheet.md
[Drupal 8 Twig cheatsheet] #tags: drupal8, twig, cheatsheet

Drupal 8 Twig cheatsheet

Getting Drupal 8 field values in Twig

Image path: {{ file_url(content.field_name['#items'].entity.uri.value) }}

Image title text: {{ node.field_name.title }}

Entity Reference path: {{ content.field_tags[0]['#url'] }}

@mogtofu33
mogtofu33 / MY_D8_THEME.theme
Last active August 24, 2022 09:24
Drupal 8 block theme suggestion based on block type, region, provider and display.
<?php
/**
* @file
* Preprocess and suggestions for a Drupal sub-theme.
*
*/
use Drupal\node\NodeInterface;
use Drupal\media\MediaInterface;
@mogtofu33
mogtofu33 / config_dev.rb
Created May 10, 2017 21:51
Sample Drupal Bootstrap sass subtheme config, development.
# Change this to :production when ready to deploy the CSS to the live server.
environment = :development
#environment = :production
# If in development (set above), we can turn on the sourcemap file generation.
# Requires sass 3.3+ and compass 1.0+
# Determine version from command line: sass --version && compass --version
sourcemap = (environment == :development) ? true : false
# Alternative development debugging methods
@mogtofu33
mogtofu33 / config_prod.rb
Last active May 10, 2017 21:49
Sample Drupal Bootstrap sass subtheme config, production.
# Change this to :production when ready to deploy the CSS to the live server.
#environment = :development
environment = :production
# If in development (set above), we can turn on the sourcemap file generation.
# Requires sass 3.3+ and compass 1.0+
# Determine version from command line: sass --version && compass --version
sourcemap = (environment == :development) ? true : false
# Alternative development debugging methods