Ditch the Display Suite Module | Unleashed Technologies
Loading...

Ditch the Display Suite ModuleDisplay Suite is a great module and we love using it with Drupal 7. However, when Drupal 8 added Layouts to core and title is now a block, we had to ask ourselves, why do we use Display Suite?

We at Unleashed Technologies had begun using Zurb Foundation and abandoned the Bootstrap theme for all Drupal 8 projects. When Display Suite had a major update to their module, we had issues when using the Zurb Foundation theme. As we were trying to find a fix, we asked ourselves, what functionality do we really need from Display Suite? We only needed Layout and to have title as a field.

With Layout part of core, we had to figure out how to add title as a field in display so we can have access to the drag and drop feature. To accomplish this, we create a Pseudo Field. I began by creating a module called field_title module.

Ditch the Display Suite Module

By implementing hook_entity_extra_field_info() and hook_node_view(), we were able to create a field that will only return the current node’s title. One last functionality that we do use at times is to give our front-end developers the ability to add CSS classes to fields in display.

There are a few ways we can accomplish this:

  1. We can use the template_preprocess_field() to add attributes to our field. Below is an example on how we added the button class to the field view all link.

Ditch the Display Suite Module

  1. Or, we can use a contrib module Field Formatter Class, which is very similar to Display Suites Extra module. With this module, we can freely add classes to all the fields.

And that’s it! If you’re in the same situation as we were, give our solution a try.