Key Takeaways:
- Create a VPS (virtual private server) using your preferred provider.
- Use the open source Wireguard VPN - an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN. WireGuard is designed as a general purpose VPN for running on embedded interfaces and super computers alike, fit for many different circumstances.
A client was using the Advanced Varnish module (https://www.drupal.org/project/adv_varnish) and to my surprise, there was no cache invalidation built into it.
The idea is that whenever a node is updated or deleted, a cache invalidation request is sent automatically to Varnish cache.
First, build the cache invalidation function in a custom module, in the .module file:
The client request was to build a View node listing for the home page (content type = page) but exclude nodes that were flagged to appear in the menu (any menu). I has to use hook_views_query_alter() for this and here is the full example:
Usage:
Load an entity object
$user = entityManage('user', 1);
$node = entityManage('node', 1);
Update a node's title
entityManage('node', 1, ['title' => 'New title']);
Get a list of inactive users
$inactiveUsers = entityManage('user', ['status' => 0]);
Get a list of taxonomy terms
The twig time_diff filter is not a built-in Twig filter in Drupal 9. To achieve the desired functionality, you need to create a custom Twig filter.
Here's a step-by-step guide on how to add a custom time_diff filter in your Drupal 9 site:
Step 1: Create a Custom Module
First, create a custom module. For example, let's name it custom_twig_filters.
1. Create the module directory:
web/modules/custom/custom_twig_filters
Inside that directory, create the following files: