Why We Ditched the Display Suite Module in Drupal 8
We at Unleashed 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 .
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:
- 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.
- 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.