By editor, 30 September, 2021 Translation API - PHP Twig JavaScript Tags Drupal 8 Drupal 9 Translation JavaScript Twig PHP PHP Class using StringTranslationTrait StringTranslationTrait allow to get t() and formatPlural() methods Example: use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\Core\StringTranslation\TranslationInterface; class MyClass {
By editor, 4 June, 2016 Inline template with Drupal 8 and Twig Tags Drupal 8 Code Theming Twig Example 1. Basic inline template $output[] = [ '#type' => 'inline_template', '#template' => '{{ yourvar }}', '#context' => [
By editor, 20 May, 2016 Render Custom field with Drupal Renderer Tags Drupal 8 Code Twig Images Example 1, with FieldPluginBase (\Drupal\views\Plugin\views\field\FieldPluginBase)
By editor, 11 May, 2016 Add twig template to a custom Module, Block or Page Tags Drupal 8 Code Theming Twig Step 1. Create your module and Block (/tutoriels/107/create-a-simple-block-programmatically)
By editor, 27 April, 2016 Theming : enable Twig templates Debug Tags Drupal 8 Theming Twig Enable debugging You enable Twig Debugging in sites/default/services.yml. (If services.yml does not yet exist; copy default.services.yml and rename it to services.yml.) parameters: twig.config: debug: true
By editor, 20 March, 2016 Drupal 8 Theming with Twig Tags Drupal 8 Twig Theming Print : {{ variable_to_print }} Code : {% codes %} Comment : {# Comments #}