Skip to content

Instantly share code, notes, and snippets.

View WengerK's full-sized avatar
🤓

Kevin Wenger WengerK

🤓
View GitHub Profile
@WengerK
WengerK / README.md
Last active March 27, 2024 10:38
Debug Drupal - KernelTest, BrowserTest & JavascriptTest

Debug Drupal - KernelTest, BrowserTest & JavascriptTest

Debugging tests can often be a pain, but using those snippets it's possible to get a lot of informations when using BrowserTestBase or JavascriptTestBase.

Get HTML of a page

Sometimes you'll want to inspect the HTML of the page or a specific element. There is no official method for this yet but the following works:

$this->assertEquals('', $this->getSession()->getPage()->getHTML());
@WengerK
WengerK / README.md
Last active December 14, 2018 09:01
Article Ressources - Set up workflows with State Machine on Drupal Commerce 2.x

Article Ressources - Set up workflows with State Machine on Drupal Commerce 2.x

This is the Gist repository for my article Set up workflows with State Machine on Drupal Commerce 2.x.

Be aware that this article has been wrote for the Blog of Antistatique — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

Feel free to read it the full article on Medium or check it out on Antistatique.

Content of this Gist :

  • WorkflowHelper.php : Contains helper methods to retrieve workflow related data from entities.
@WengerK
WengerK / README.md
Last active July 18, 2018 12:35
Article Ressources - Template Whisperer - Content-first templating in Drupal 8

Article Ressources - Template Whisperer - Content-first templating in Drupal 8

This is the Gist repository for my article Template Whisperer - Give more content confidence to your end-client.

Be aware that this article has been wrote for the Blog of Antistatique — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

Feel free to read it the full article on Medium or check it out on Antistatique.

Content of this Gist :

  • settings.php : Settings overriden manually to tweak the Flood Control
@WengerK
WengerK / README.md
Last active June 22, 2018 07:32
Article Ressources - Flood Control protection in Drupal 8

Article Ressources - Flood Control protection in Drupal 8

This is the Gist repository for my article Flood Control protection in Drupal 8.

Be aware that this article has been wrote for the Blog of Antistatique — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

Feel free to read it the full article on Medium or check it out on Antistatique.

Content of this Gist :

  • settings.php : Settings overriden manually to tweak the Flood Control
@WengerK
WengerK / README.md
Last active December 31, 2019 22:37
Article Ressources - Drupal 8 - Bamboo Twig, Beyond Twig

Article Ressources - Drupal 8 - Bamboo Twig, Beyond Twig

This is the Gist repository for my article Drupal 8 - Bamboo Twig, Beyond Twig.

Be aware that this article has been wrote for the Blog of Antistatique — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

Feel free to read it the full article on Medium or check it out on Antistatique.

Content of this Gist :

  • bamboo_twig_renderer.html.twig : Renderer
@WengerK
WengerK / README.md
Last active March 2, 2018 16:27
Article Ressources - Google Tag Manager: Tracking of Ajax actions

Article Ressources - Google Tag Manager: Tracking of Ajax actions

This is the Gist repository for my article Google Tag Manager: Tracking of Ajax actions.

Be aware that this article has been wrote for the Blog of Antistatique — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

Feel free to read it the full article on Medium or check it out on Antistatique.

Content of this Gist :

@WengerK
WengerK / README.md
Last active November 22, 2023 19:42
Drupal 8 - How to translate Config API

Article Ressources - Drupal 8, How to translate Config API

This is the Gist repository for my article Drupal 8, How to translate Config API.

Be aware that this article has been wrote for the Blog of Antistatique — Web Agency in Lausanne, Switzerland. A place where I work as Full Stack Web Developer.

Feel free to read it the full article on Medium or check it out on Antistatique.

Content of this Gist :

  • SettingsForm.php : Basic Form Config
@WengerK
WengerK / README.md
Last active August 20, 2019 09:08
Drupal 8 - Debugging Ajax Commands & Dialogs

Drupal 8 - Debugging Ajax Commands & Dialogs

'Cause it's nearly impossible to var_dump or dump into an Ajax Dialog or an Ajax Command, the most easier way is to write into the Apache logs.

To do this, just add the following snippet in your code:

error_log(var_export($var), TRUE);
@WengerK
WengerK / databaseService.php
Created September 4, 2017 09:46
Drupal 8 - Print raw SQL queries for debugging
<?php
/**
* Debugging using the database connection.
*/
/** @var \Drupal\Core\Database\Connection */
$connection = \Drupal::service('database');
$query = $connection->select('node', 'node');
$query->fields('node', ['nid'])
@WengerK
WengerK / README.md
Last active January 4, 2022 21:15
Programatically use Solr on Drupal 8

🔍 Solr (6.1.0+) search Engine & Tika (1.13+) Extractor

We are using solr for search index.

Solr need to be configured for drupal. Follow the INSTALL.txt found in the search_api_solr module.

As a pre-requisite for running your own Solr server, you'll need Java 6 or higher.

Installation