Skip to content

Instantly share code, notes, and snippets.

View Luukyb's full-sized avatar

Luc Bézier Luukyb

View GitHub Profile
@mecmartini
mecmartini / render-reponsive-image-style-twig-drupal.html-twig
Created December 13, 2019 17:18
How to render responsive image style on Twig in Drupal
{% set imagePath = 'public://images/default.jpg' %}
{% set responsiveimagestyle = {
'#theme': 'responsive_image',
'#responsive_image_style_id': 'my_responsive_image_style_id',
'#uri': imagePath,
'#alt': 'my alt text',
'#attributes': { class: 'img-responsive' },
} %}
{{ responsiveimagestyle }}
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active September 20, 2024 18:08
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@DuaelFr
DuaelFr / ReferenceLastDate.php
Created February 7, 2019 14:03
Drupal 8 Search API processor example
<?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;
@cesarmiquel
cesarmiquel / drupal-8-cheatsheet.md
Last active September 16, 2024 14:43
Drupal 8/9/10 Cheatsheet

Drupal 8 Cheatsheet

[Update 2024] - This gist is almost useless compared to Drupal at your fingertips. Will create pull requests to update that if something is not already there.

Files, Images and Media

// Load file object
$file = File::load($fid);
@grasmash
grasmash / acsf-cm.md
Last active August 22, 2022 15:31
Configuration management best practices for ACSF.

This tutorial covers common use cases for configuration splits as a strategy for configuration management in Drupal 8.

Specifically it covers:

  • Default application configuration
  • Environment specific configuration (e.g., local, data, test, prod, etc.)
  • Site-specific configuration (when multisite is used)
  • "Feature" specific configuration (e.g. a distinct blog feature that is shared across multiple sites). Not to be confused with the features module.
  • Miscellaneous troubleshooting information