Accelerate the site building of a Drupal 8 project

A hourglass

It is not uncommon for a Drupal 8 project, because it has structured content, to develop many content types, each with many fields, which are themselves rendered in a different way through no less than many display modes. One of the consequences is that the design phase known as site building can then become extremely time-consuming, or even a source of many small and even more time-consuming omissions to correct / adjust (use of the same fields, associated help text, configuration of the form mode, display modes, etc.). And this can make this design phase appear to be the least motivating, although essential, phase.

For those who have already produced an ambitious Drupal 8 project, this must certainly bring back some memories.

Fortunately, with Drupal 8 we have two modules that allow us to significantly simplify and accelerate this phase. These are the Entity Clone and Field Tools modules. Let us briefly present these two modules to be consumed without moderation.

Entity clone

Entity Clone is a module that allows you to clone any content entity (or almost), including node, taxonomy terms, etc., but also some entity types and therefore content types. Thus, duplicating a complex content type, with many fields, can be done with a simple click, in a few seconds, then allowing to customize on a common and identical basis the different fields of a new type of content.

Its use is very simple. One click on the Clone operation and that's it.

Entity clone operation

In addition to the usual case of accelerating the site building phase of an ambitious project, this module can also be particularly useful in the context of a native multi-site architecture to provide semantically different but extremely similar content types in terms of configuration. And also in the context of a Drupal web Factory based on the Micro Site module, where this module can help us this time to clone the Site content entity, allowing us to create a new site, pre-configured and with existing content, with a simple click.

Its dual use both on content entities (which can save considerable time in terms of initial content production when it is relatively structured and rich, especially with paragraphs) and on entity types makes it particularly useful from all points of view. And to complete the table it should be mentioned that the Entity Clone module (in its dev version to date) is able to clone (or not, depending on the configuration of the module) any entity referenced by the cloned source entity. This is particularly effective for any content using paragraphs. Note the existence of a module, Entity Type Clone, with a more limited functional scope, focused on entity types, which I have not had the opportunity to test yet.

Field tools

The Field Tools module plays in another register. It allows you to duplicate fields, their display configurations, as well as display modes from one content type (or entity type in general) to one or more other bundles. This is particularly useful if you already have the different content types (and therefore cannot clone them) and you want to duplicate a field, a display mode, very quickly to other bundles. 

Its use is also rather intuitive. You can access the configuration page for each entity type from the Clone fields link in the list of available operations (as for the Entity Clone module) or from the Tools tab of the entity type.

Field tools usage

We can select the field(s) to duplicate, then select the different bundles to duplicate these fields to. A dreadful efficiency for anyone who has forgotten to add a field on the fifteen content types of a project.

By way of conclusion

These two modules can be added to your base module list for any Drupal 8 project. They can save you a multitude of clicks, many hours and most certainly also some omissions and errors for those who want to optimize the use of fields by a maximum transversal use through the different entity types of a Drupal 8 project. Whether it is in terms of initial design, or in terms of project maintenance, or even the subsequent exploitation of these fields through a business module. In any case, they have already saved me a lot of time, and certainly also kept the motivation of a Drupal developer intact. 


Ajouter un commentaire