developer resources
Codebales holds an ever growing number of solutions to problems that we have experienced in our day to day code writing
Selected filter
39
results
Andrew Fletcher
•
Do you want to know how to add a node alias in a twig file? Rather than do the set up in a custom module or using your theme file.
To be able to create a node alias in a twig file you need to know the node.nid value. Obviously without it you have nothing to reference from. In this example, the node.nid value is extracted during a loop. A fairly standard loop such as
{% for row in rows %}
// ... script doing some magic ... //
{% endfor %}Begin by setting the nid value...
Andrew Fletcher
•
Currently I'm working through an app that has been abandoned by the developers....
Andrew Fletcher
•
Having access to a site’s URL in your templates can come in handy for many...
Andrew Fletcher
•
I want to create a content type that has a paragraph. Easy enough.
What...
Andrew Fletcher
•
Since upgrading to Drupal 9.3.0 have you come across this error?
Edit...
Andrew Fletcher
•
When you have an entity ID value such as node ID (nid) or taxonomy term ID, how can you create the alias in a twig file? In other words, instead of /taxonomy/term/{tid} I would like to get the alias I have defined for this, eg: /some/path/to/my/term.
In trying to find an answer you might have queried your search criteria using something like
twig canonical taxonomy path
twig canonical entity path
twig canonical node path
How to achieve
This is achieved through using the...
Andrew Fletcher
•
Working in Twig, I had to add classes to a pre-existing array. Whilst I've...
Andrew Fletcher
•
Time is essential to all of us... and if you are like me there is never enough...
Andrew Fletcher
•
Working in Laravel, I needed to loop through an array and know whether the...