{"id":5580,"date":"2019-12-11T09:00:10","date_gmt":"2019-12-11T09:00:10","guid":{"rendered":"https:\/\/www.register365.com\/blog\/?p=5580"},"modified":"2019-12-13T09:18:10","modified_gmt":"2019-12-13T09:18:10","slug":"drupal-entities-the-building-blocks-of-the-data-model","status":"publish","type":"post","link":"https:\/\/www.register365.com\/blog\/drupal-entities-the-building-blocks-of-the-data-model\/","title":{"rendered":"Drupal entities &#8211; the building blocks of the data model"},"content":{"rendered":"\n<p>What is an\nentity? Merriam-Webster defines an entity as \u201csomething that exists by itself\u201d.\nDevelopers using languages such as C# or Java will be familiar with Objects.\nDatabase analysts will know an entity as a real-world object represented in a\ndatabase. <\/p>\n\n\n\n<p>Drupal\nintroduced the concept of entities in Drupal 7, replacing the need for awkward\nCustom Fields. In Drupal 8, entities came of age and are now the building\nblocks of the data model for both content and configuration. When learning\nDrupal basics its essential to get a thorough grasp of entities. Here we take a\nlook at Content and Configuration entities in Drupal, what they are and how\nthey are used.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Content and configuration entities<\/h2>\n\n\n\n<p>Although\nDrupal refers to both of these as entities, they are quite different. In Drupal\n8, a configuration entity is used to store the information for the site\u2019s\nconfigurable settings, such as image styles and user roles. <\/p>\n\n\n\n<p>A content\nentity is piece of content data, such as a node, taxonomy or block. Once an\nentity has been created with data input, it is known as an instance of the\nentity type.<\/p>\n\n\n\n<p>The Entity types have sub-types, allowing for variations in their behaviour. For example, a content item may have sub-types of basic page and vendor page. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Bundles<\/h2>\n\n\n\n<p>Bundles are\nused as containers for sub-types of an entity, this allows for a common set of\nfields for the entity type, but additional fields for sub-types. For example,\nthe node entity has bundles for its sub-types such as article, blog post and\npage. All node entities will have fields such as title and author, but the\narticle sub-type would have a tag field.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Fields<\/h2>\n\n\n\n<p>Fields are\nadded to content entities to make up the detail of the data model. Drupal has a\nlarge range of core field types: Boolean, number fields such as integer, float\nand decimal, image and text fields. These can be extended with custom field\ntypes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Plugs-ins<\/h2>\n\n\n\n<p>A plugin is\na design pattern that allows a developer to code different functionality for\ndifferent modules. The plugin appears the same to the code that uses it &#8211; it\nadheres to the interface for the plugin type &#8211; but executes code relevant and\nunique to the module.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Annotations<\/h2>\n\n\n\n<p>Annotations\nare PHP code comments used to define metadata about a class or function. They\nallow plugins to be \u201cdiscovered\u201d when loading the classes for an entity type.\nFor example, an annotation for the block class would contain an @Block tag. The\nblock manager will discover this custom block and make it available.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Handlers<\/h2>\n\n\n\n<p>Handlers\nare Drupal 8\u2019s upgrade from Drupal 7\u2019s controllers. They provide a flexible way\nof handling API pieces. By using handlers, subsystems can be built in a\npluggable way. They help administrators to manage storage and access control\nand the forms needed for creating and updating entities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Drupal Summary<\/h2>\n\n\n\n<p>In Drupal 8, entities are the building blocks of the data model. When learning Drupal basics, it&#8217;s vital to understand that everything is an entity. Entities all have values and properties, which gives a cohesive development method. By understanding the relationships between entity types, fields and bundles, we can make the most of Drupal\u2019s development environment.<\/p>\n\n\n\n<p>If you need hosting for your Drupal website, you&#8217;ve landed in the right place. Grab your hosting <a href=\"https:\/\/www.register365.com\/web-hosting\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is an entity? Merriam-Webster defines an entity as \u201csomething that exists by itself\u201d. Developers using languages such as C# or Java will be familiar with Objects. Database analysts will&#8230; <a class=\"more-link\" href=\"https:\/\/www.register365.com\/blog\/drupal-entities-the-building-blocks-of-the-data-model\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":22,"featured_media":5493,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[589,122],"tags":[],"class_list":["post-5580","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-design","category-web-hosting-2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Drupal entities - the building blocks of the data model<\/title>\n<meta name=\"description\" content=\"Drupal introduced the concept of entities in Drupal 7, replacing the need for awkward Custom Fields. We&#039;re taking a deeper look into the entities.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Drupal entities - the building blocks of the data model\" \/>\n<meta property=\"og:description\" content=\"Drupal introduced the concept of entities in Drupal 7, replacing the need for awkward Custom Fields. We&#039;re taking a deeper look into the entities.\" \/>\n<meta property=\"og:url\" content=\"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/\" \/>\n<meta property=\"og:site_name\" content=\"Register365 Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/register365\" \/>\n<meta property=\"article:published_time\" content=\"2019-12-11T09:00:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-12-13T09:18:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.register365.com\/blog\/wp-content\/uploads\/2019\/10\/Drupal.png\" \/>\n\t<meta property=\"og:image:width\" content=\"945\" \/>\n\t<meta property=\"og:image:height\" content=\"425\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Nathan\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nathan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.register365.com\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/\",\"url\":\"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/\",\"name\":\"Drupal entities - the building blocks of the data model\",\"isPartOf\":{\"@id\":\"https:\/\/www.register365.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#primaryimage\"},\"image\":{\"@id\":\"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.register365.com\/blog\/wp-content\/uploads\/2019\/10\/Drupal.png\",\"datePublished\":\"2019-12-11T09:00:10+00:00\",\"dateModified\":\"2019-12-13T09:18:10+00:00\",\"author\":{\"@id\":\"https:\/\/www.register365.com\/blog\/#\/schema\/person\/b8684be81b9b651f59d97f7bac864748\"},\"description\":\"Drupal introduced the concept of entities in Drupal 7, replacing the need for awkward Custom Fields. We're taking a deeper look into the entities.\",\"breadcrumb\":{\"@id\":\"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#primaryimage\",\"url\":\"https:\/\/www.register365.com\/blog\/wp-content\/uploads\/2019\/10\/Drupal.png\",\"contentUrl\":\"https:\/\/www.register365.com\/blog\/wp-content\/uploads\/2019\/10\/Drupal.png\",\"width\":945,\"height\":425,\"caption\":\"Drupal Website\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Register365\",\"item\":\"\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Blog\",\"item\":\"https:\/\/www.register365.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Web Hosting\",\"item\":\"https:\/\/www.register365.com\/blog\/category\/web-hosting-2\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Drupal entities &#8211; the building blocks of the data model\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.register365.com\/blog\/#website\",\"url\":\"https:\/\/www.register365.com\/blog\/\",\"name\":\"Register365 Blog\",\"description\":\"Welcome to the Register365 blog! Keep up to date with our latest news and product updates, find out more about our Free Online Business Training, and share your comments with us!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.register365.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.register365.com\/blog\/#\/schema\/person\/b8684be81b9b651f59d97f7bac864748\",\"name\":\"Nathan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.register365.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b849f2ae94026a2583ec808f66065701dbebe5ca9a87e51fab1269f2853c4a71?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b849f2ae94026a2583ec808f66065701dbebe5ca9a87e51fab1269f2853c4a71?s=96&d=identicon&r=g\",\"caption\":\"Nathan\"},\"description\":\"Nathan has been with team.blue since 2005 and has a background in Technical Support. He is passionate about helping customers find the best product for them and use it to its full potential. In his free time you'll find him on a train travelling through some beautiful countryside, or curled up on a sofa with his head in a book.\",\"url\":\"https:\/\/www.register365.com\/blog\/author\/nathan\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Drupal entities - the building blocks of the data model","description":"Drupal introduced the concept of entities in Drupal 7, replacing the need for awkward Custom Fields. We're taking a deeper look into the entities.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/","og_locale":"en_GB","og_type":"article","og_title":"Drupal entities - the building blocks of the data model","og_description":"Drupal introduced the concept of entities in Drupal 7, replacing the need for awkward Custom Fields. We're taking a deeper look into the entities.","og_url":"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/","og_site_name":"Register365 Blog","article_publisher":"https:\/\/www.facebook.com\/register365","article_published_time":"2019-12-11T09:00:10+00:00","article_modified_time":"2019-12-13T09:18:10+00:00","og_image":[{"width":945,"height":425,"url":"https:\/\/www.register365.com\/blog\/wp-content\/uploads\/2019\/10\/Drupal.png","type":"image\/png"}],"author":"Nathan","twitter_misc":{"Written by":"Nathan","Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.register365.com\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/","url":"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/","name":"Drupal entities - the building blocks of the data model","isPartOf":{"@id":"https:\/\/www.register365.com\/blog\/#website"},"primaryImageOfPage":{"@id":"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#primaryimage"},"image":{"@id":"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#primaryimage"},"thumbnailUrl":"https:\/\/www.register365.com\/blog\/wp-content\/uploads\/2019\/10\/Drupal.png","datePublished":"2019-12-11T09:00:10+00:00","dateModified":"2019-12-13T09:18:10+00:00","author":{"@id":"https:\/\/www.register365.com\/blog\/#\/schema\/person\/b8684be81b9b651f59d97f7bac864748"},"description":"Drupal introduced the concept of entities in Drupal 7, replacing the need for awkward Custom Fields. We're taking a deeper look into the entities.","breadcrumb":{"@id":"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#primaryimage","url":"https:\/\/www.register365.com\/blog\/wp-content\/uploads\/2019\/10\/Drupal.png","contentUrl":"https:\/\/www.register365.com\/blog\/wp-content\/uploads\/2019\/10\/Drupal.png","width":945,"height":425,"caption":"Drupal Website"},{"@type":"BreadcrumbList","@id":"\/blog\/2019\/12\/drupal-entities-the-building-blocks-of-the-data-model\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Register365","item":"\/"},{"@type":"ListItem","position":2,"name":"Blog","item":"https:\/\/www.register365.com\/blog\/"},{"@type":"ListItem","position":3,"name":"Web Hosting","item":"https:\/\/www.register365.com\/blog\/category\/web-hosting-2\/"},{"@type":"ListItem","position":4,"name":"Drupal entities &#8211; the building blocks of the data model"}]},{"@type":"WebSite","@id":"https:\/\/www.register365.com\/blog\/#website","url":"https:\/\/www.register365.com\/blog\/","name":"Register365 Blog","description":"Welcome to the Register365 blog! Keep up to date with our latest news and product updates, find out more about our Free Online Business Training, and share your comments with us!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.register365.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.register365.com\/blog\/#\/schema\/person\/b8684be81b9b651f59d97f7bac864748","name":"Nathan","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.register365.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b849f2ae94026a2583ec808f66065701dbebe5ca9a87e51fab1269f2853c4a71?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b849f2ae94026a2583ec808f66065701dbebe5ca9a87e51fab1269f2853c4a71?s=96&d=identicon&r=g","caption":"Nathan"},"description":"Nathan has been with team.blue since 2005 and has a background in Technical Support. He is passionate about helping customers find the best product for them and use it to its full potential. In his free time you'll find him on a train travelling through some beautiful countryside, or curled up on a sofa with his head in a book.","url":"https:\/\/www.register365.com\/blog\/author\/nathan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/posts\/5580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/comments?post=5580"}],"version-history":[{"count":2,"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/posts\/5580\/revisions"}],"predecessor-version":[{"id":5583,"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/posts\/5580\/revisions\/5583"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/media\/5493"}],"wp:attachment":[{"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/media?parent=5580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/categories?post=5580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.register365.com\/blog\/wp-json\/wp\/v2\/tags?post=5580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}