Theme Options

Should We Re-use Existing Fields in Drupal?

Drupal gives you the ability to re-use fields. If you have an "Image" field, you could choose to use that same field on every content type on your site. However, it's not always clear whether re-using fields is a good idea. Sometimes it is, sometimes it isn't.

It is recommended to create new fields, rather than reusing existing ones, unless you have a clear reason to do so.

Advantage: re-using fields can make your simpler and some content works well with re-used fields

A more compelling advantage is that re-using fields can sometimes make site administration simpler

Reuse of fields can also reduce the system’s complexity. Instead of creating and maintaining 10 different fields, Drupal admins maintain only two fields and their documentation. Database administrators only need to improve performance of two extra tables. KISS is always a good principle.

It definitely would be easier to apply permissions, setting and design elements to one re-used field rather than 10 unique fields.

reusing fields also allows you to display, filter, group, and sort content together by field across content types. For example, the contributed Views module allows you to create lists and tables of content. So if you use the same field on multiple content types, you can create a View containing all of those content types together displaying that field, sorted by that field, and/or filtered by that field.

Disadvantage: Re-used fields are inflexible and Re-used fields make data harder to export or migrate

at first it's a good idea, but give it a few weeks, reqs change, you end up creating separate ones anyway

Each Drupal field has it's own database table, as shown below. Extracting that data can be tough. The Features module (the most common way to export Drupal data) struggled for a long time with shared fields, although current versions can handle them more effectively.


Comments (0)

The content of this field is kept private and will not be shown publicly.