Drupal

Blog

Delete all menu links of a menu programmatically in drupal 8

I play a lot with importing and exporting content lately. When I remove content, the created menu items need to be removed automatically. Here's a snippet on how to delete all links in a menu.

Blog

Create a menu link with html markup in drupal 8 (menu plugin tutorial)

Goodbye preprocess functions! Welcome to drupal 8. We use a nice plug-in to get control over our menu item and to show html inside the title. In this case we show a counter of the amount of messages a user has.

Blog

Format created date of custom entity in drupal 8 [Solved]

Some parts of custom entities seem different from nodes, but mostly they aren't. Small snippet for showing a created date of a custom entity in a controller

Blog

Fix "The provided host name is not valid for this server" error of drupal 8

When installing drupal 8, or moving to production one could see this error. The fix is extremely simple. 

Blog

Serve a pdf download in controller in drupal 8

Quick tutorial on how to serve a PDF that downloads automatically in your browser in drupal 8.

Blog

Change the page title of the user edit form in drupal 8 with a RouteSubscriber

Sometimes simple tasks like changing a page title of a system page can be hard. Luckily, drupal 8 provides clean ways to do that. In this tutorial some info about RouteSubscribers.

Blog

How to create menulink programmatically in drupal 8 [SOLVED]

When creating seed data, for example in your modules hook_install() script, creating a menulink can be necessary. This snippet shows how.

Blog

Use html markup in form labels in drupal 8

Getting the output like you want it to be an be quite a challenge in drupal. This snippet shows you how you can add markup to your form labels in drupal 8.

Blog

Validate a UUID in drupal 8 (check if uuid is valid)

In drupal 8, each entity will get a UUID assigned automatically. With this snippet you can check if it is a valid one.

Blog

Drupal 8 check if user is logged in

Check if a user is logged in in drupal 8

Subscribe to Drupal