Skip to content

Instantly share code, notes, and snippets.

@raphaellarrinaga
raphaellarrinaga / drupal_8_twig_cheatsheet.md
Last active July 20, 2023 21:21
[Drupal 8 Twig cheatsheet] #tags: drupal8, twig, cheatsheet

Drupal 8 Twig cheatsheet

Please note I created that sheet as a personal side note/draft and not everything is fully tested. There could be errors or better things to do. So if you spot something wrong or something that can be improved, feel free to comment below and I will do the changes.

Getting Drupal 8 field values in Twig

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

  lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
  lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n''          %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
@raphaellarrinaga
raphaellarrinaga / livereload_port.md
Last active March 5, 2018 19:42
Livereload: Occupied port Issue

Livereload: Fix occupied port issue

List all Listening tasks

$ lsof | grep LISTEN

Run this command to kill the process by port

$ kill -9 $(lsof -t -i :35729)

@raphaellarrinaga
raphaellarrinaga / php_server.md
Last active March 5, 2018 19:41
Use PHP build in server

Use PHP build in server

Test php server. Chose the port you want

$ php -S localhost:8081

@raphaellarrinaga
raphaellarrinaga / drupal_8_php_cheat.md
Last active September 4, 2022 21:49
[Drupal 8 php/config cheatsheet] #tags: drupal8, php, config, cheatsheet

Drupal 8 PHP cheatsheet

Get current node id

$node = \Drupal::routeMatch()->getParameter('node');
if ($node instanceof \Drupal\node\NodeInterface) {
  $nid = $node->id();
}
@raphaellarrinaga
raphaellarrinaga / xdebug_config.md
Last active February 17, 2018 10:31
Some option to configure xdebug with sublime, drupalvm
@raphaellarrinaga
raphaellarrinaga / drupal_install.md
Last active October 6, 2021 07:55
[Drupal install & config process from scratch] #tags: drupal, drupal8, config

// Update 2021

composer create-project drupal/recommended-project myproject -n or

composer create-project drupal/recommended-project:^8.9 myproject -n

cd myproject
lando init --source cwd --recipe drupal8 --webroot web --name myproject
lando start
@raphaellarrinaga
raphaellarrinaga / git_cheatsheet.md
Last active July 16, 2020 08:58
[GIT cheatsheet] #tags: git, cheatsheet
@raphaellarrinaga
raphaellarrinaga / worpress_install.md
Last active February 17, 2018 10:29
Wordpress ressources for a VM + composer installation & notes