0

Assuming it is possible to understand what is a Drupal entity without knowledge and experience in coding with the main program-code of Drupal 8 (PHP), or rather without understanding relevant OOP concepts such as class and instantiation, I ask:

What is an entity in Drupal (at least for non Drupal-programmers)?
An answer will help to understand a more complex term → entity type.

  • It is interesting to note I didn't find a session about this here, nor I found a similar session outside SE, in a quick search; I found some "what is the difference between entity to Y" but this is not what I was looking for. – user16289 Jan 8 at 4:05
  • 1
    There are quite extensive docs on the whole topic on drupal.org. – leymannx Jan 8 at 14:06
  • 2
    @leymannx entity API? I didn't think about this "concept"; IMO, generally, or mostly, the docs at DO are aimed for Drupal programmers. – user16289 Jan 8 at 14:42
5

An Drupal entity is a group of one or more fields that correspond to a relational database containing one or more serialized storage units (say, one or more tables).

The simplest entity will contain one field corresponding to one serialized storage unit (say, one table) of a relational database.

In a programmatic and GUI sense:

  • Drupal entities are fieldable in the sense that one can easily add fields to it as it is a "field bundle", without writing further code; simply by pointing, clicking, and typing in the admin interface of a Drupal website

  • Drupal entities are displayable in the sense that one can easily control what Fields are shown, hidden, or displayed in different styles without writing custom template or CSS code; simply by pointing and clicking on the admin interface of a Drupal website.

With the years, Drupal entities have had more services, wrappers and syntactic sugar added to make them more useful.

Entity types

Entities can be of different types (entity type) and Drupal has several such types in core.
Entity types allow creation of custom entity types.

In another way to put it, an entity is an object of data (model) and entity types would be different subtypes of that entity.

Note

An entity concept is not unique to Drupal → you can look at other frameworks for a similar implementation, as in Symfony, Rails or Django (and plenty more).

Further reading

| improve this answer | |
3

If you want to know non-Drupal at a very high level, an Entity is an object of data (model), entity types would be different subtypes of that entity. You can look at other frameworks for an idea, like Symfony, Rails or Django (and plenty more). Entities in Drupal have had a lot of services, wrappers and syntactic sugar added to make them useful - that is, Drupal comes with a lot of plumbing provided. This is why most people tend to lean on Node for almost everything, even in cases where you shouldn't.

While the terminology can vary platform to platform, the concepts are similar. Drupal entities look 'different' because a lot of the heavy lifting is abstracted for you through various APIs.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy