Fields in Drupal are used as the building blocks for your content, fields can be added to various entity types to allow you complete control over the data that you store. Drupal offers a wide range of field types both out of the box and through a number of contributed modules so you can be very specific over the types of data each field should use. In addition to this you can also control the type of widget used to collect the data and how this data gets displayed to your users using field formatters. See below for some of our article on Drupal fields....
Read some of our articles about Drupal fields
Sometimes it can be handy to have extra pages for a node (or any entity). For example: * To show different sets of information on separate pages for a single product, page, or thing. * So you can set different access requirements on each page for a node. * You want to block access to the ordinary route (e.g. node/123 and its aliased equivalent) for some reason, but you still want some other page to...
CM Drupal Contribution Challenge 2020
This is part 3 in my series of articles about creating a custom field. I recommend reading Part 1: Field type and Part 2: Field widget first, if you have not done so already. After creating the field type and field widget it is now time to complete the set by creating the field formatter. ##a) Create the file The field type must be located as follows: /lib/Drupal/ /Plugin/field/formatter/ .php N.B. The field formatter...
This is part 2 in my series of articles about Drupal widgets, and specifically creating a custom field. I recommend reading Part 1: Field type first, if you have not done so already. After creating the field type it is now time to create the field widget. ##a) Create the file The field widget must be located as follows: /lib/Drupal/ /Plugin/field/widget/ .php N.B. The field widget name should be in CamelCase. ##b) Add Contains, namespace...
Having written articles on how to create a Drupal 8 field type, field widget and field formatter I thought that now is the time to explain why you might want to create a custom field type. More specifically, why I have created a custom field. To provide some context: my pet Drupal 8 project is to produce a companion site for players of the Fantasy Football (soccer) game Fantasy Premier League (N.B. this is not...
I have been experimenting with the Alpha release of Drupal 8 and so I'm sharing some of my experiences so that you can avoid the pitfalls I have encountered. First I would like to give credit to the two articles I used during the exercise: * Upgrading Code Snippets Module to Drupal 8: Creating a Custom Field * D7 to D8 upgrade: fields, widgets and formatters Hopefully this article will provide a third point-of-view to...
Drupal 7 fields are great, but using multiple valued fields and [field collection][fc] you can quickly reach the point of having a form that looks like this:
In this contrived example I've got two field collections and a multi-valued 'Links' field within that. Although it's reasonably clear what clicking 'Add another item' will do in each case, when the form is full of data it can become less so. We...