Custom Content Types¶
Brief Background for Custom Content Types¶
From the early versions of Drupal, the concept of a
node was central to how content management was handled.
Originally the node was used for various things like articles and blog pages. Over time, the use of the node was
extended to many other uses by the ability to attach many different field types to a node, like file attachments or
datetime fields. In Drupal 8, this concept was extended to many more entities (e.g., taxonomy, blocks) such that
many entities besides nodes can now have different fields attached to them by the site builder.
In many ways, however, the node is still the center of content types in Drupal. It is usually the easiest to work with because it has the most mature set of integrations with the underlying CMS. Currently we find using the node as the central entity type entirely adequate as well as the simplest approach, so this is the approach taken in this version of MyLabBook.
Custom Content Types in MyLabBook¶
We can extend the basic node entity by attaching different fields. Once we do that, we are creating a new type of
node, which is often referred to as a
Custom Content Type. For MyLabBook, at this point we have only two
Custom Content Types, the Experiment and the ProtocolStep.
Custom Content Type of an Experiment¶
The Experiment custom content type stores the metadata for the experiment along with acting as a container for all of the protocol steps in the experiment.
Custom Content Type of a Protocol Step¶
The heart of MyLabBook is the Protocol Step custom content type. It is these protocol steps that make up the steps in an experiment. They could also have been called an Experimental Step, but in most cases during an experiment the researcher is following or developing some type of protocol. For that reason and to ease problems with namespace collision, the name of Protocol Step is used instead. This is also consistent with the nomenclature used by other ELNs.
Each Protocol Step contains the fields that are needed for the given step of the experiment. There are a few different approaches that can be taken for creating a basic Protocol Step custom content type.
- Create one Protocol Step custom content type that has all of the fields that you will need for any step that you have in your experiment. Then use that Protocol Step for each step in your experiment, leaving fields blank if they are not needed.
- Create multiple different Protocol Step custom content types, one custom content type for each different type of step that you need. Then use the appropriate Protocol Step custom content type for a given step in your experiment.
- Use a hybrid approach between the first and second approach, so that you have a few Protocol Step custom content types and use the Protocol Step type that best fits your given experimental step, with a few of the different fields perhaps left blank in a given step.
In this first version of MyLabBook, we have taken the first approach for simplicity, but good cases can be made for the second and third approaches as well.