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 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 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 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 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 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 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 / ArticleAutoCompleteController.php
Last active May 4, 2023 19:00
Article Ressources - How to create a custom Autocomplete using the Drupal 8 Form API
<?php
namespace Drupal\my_module\Controller;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Component\Utility\Xss;
@WengerK
WengerK / AssignmentsParameters-bad.php
Created August 23, 2019 16:16
Article Ressources - Refactoring - an ode to code
function discount(\DateTime $start_date, $bar) {
if ($bar > 50) {
$start_date->add('2 days');
}
// do some calculation based on the $start_date...
return $foo;
}
@WengerK
WengerK / .travis.yml
Last active August 27, 2020 09:33
Drupal 8 contributed modules using Docker
language: php
services:
- docker
env:
global:
# The module name to be mounted and tested in the Docker.
- MODULE_NAME="my_module"
@WengerK
WengerK / MyKernelTest--no-create.php
Created February 19, 2021 13:40
Article Ressources - Factory Lollipop - Speeding up Kernel tests on Drupal
<?php
/**
* Example of Factory Lollipop usage for a KernelTest.
*/
class MyKernelTest extends LollipopKernelTestBase {
/**
* {@inheritdoc}
*/