Today I'd like to discuss a little Drupal 8 snippet to dynamically load an entity from the controller by the current path. This acts a bit like a Drupal 8 replacement for Drupal 7's menu_get_object(). Use case / example:
Snippets
Visual Studio Code is my new IDE love. It's simple, lightweight but brings great functionality. One little problem was that when double-clicking a variable with a dollar-sighn ("$") (for example in PHP or JavaScript) not the whole $variable
Ein typisches Problem im Umgang mit AJAX ist die (re-)Initialisierung von Scripts auf den nachträglich geladenen Inhalt. Im JTL-Shop 4 stößt man darauf beispielsweise auf Kategorieübersichten bei der Seitennavigation. Viele Systeme, viele
Simple snippet to only output the first image of an imagefield in a view and show the rest of the gallery in the photoswipe overlay. Hint: Don't forget to add the photoswipe-gallery class on the field wrapper in views settings: http://cgit
Little Drupal 7 snippet for the image_link_formatter module (https://www.drupal.org/project/image_link_formatter) to add a fallback to lightbox in size large if no link is given. Should work the same with other fallbacks (colorbox, etc.)
I just had the case to iterate over EntityReferenceRevisionsItem's which are similar to EntityReferenceItem to get the target entities, My code snippet was (WRONG EXAMPLE):
When using HOOK_node_view() you should take care because when the search (Search API especially) is indexing, this hook is also being called. You can not rely on a user displaying the node display currently. Here's a way to ensure this...
I had the requirement to check the equality of addresses in customer orders (billing / shipping) and wrote two helper functions for that. Perhaps you'll run into the same demand one day. Then please leave a comment here and in the original
This post saved you a lot of time and headache?
Then I'd be very happy about a delicious coffee! Or a helpful book from my wish list.