Blog
Blog
Give only custom block access but not block overview in drupal 8
Personally I do not like giving block access to website editors. In this one case, there was a need to edit custom blocks. I granted access to administer blocks, but I blocked access to the overview page with this EventSubscriber.
Blog
Get current user role in drupal 8 or 9
Getting the current user role in code is quite easy, here's the snippet.
Blog
Blog
Apply patch in composer without updating other modules
Patching workflow in drupal is something you need to learn a bit. I stumbled on a few cases where I would have to update one module only and want to prevent from updating the entire system. Here's the snippet
Blog
Log messages in drupal 8 & 9
Loggin is very important. These snippets need to be used, be as precise as possible.
Blog
Blog
Get paragraph type in preprocess_paragraph in drupal 8 & 9
Preprocessing on paragraphs is not used very often. But when needed, here is a snippet that gets you the correct type to add some preprocessing.
Blog
Add body classes in drupal 8 & 9
There are two ways of adding body classes. The first is to add them in twig, the second is to provide additional classes in mytheme.theme.
Blog
Add the year to your page.html.twig file
Snippet to dynamically add the year to your page.html.twig file.