DPDK Architecture  ->  Drupal (stable)

Content Types
>= v2.0.0

A single web site could contain many types of content, such as informational pages, news items, polls, blog posts, real estate listings, etc. In Drupal, each item of content is called a node, and each node belongs to a single content type, which defines various default settings for nodes of that type, such as whether the node is published automatically and whether comments are permitted.

Create a new content type

Use the following command to run the included util for creating a new content type:

cd /var/www/_scripts/utils && ./create_drupal_content_type.sh

Basic Page example

The following example will show you how we create the Basic Page (basic_page) content type:

What is the userfriendly name of the Content Type?
Content Type name: Basic Page
Fill in a userfriendly description?
Description: Basic Page
Would like the custom module to have a install file (yes/NO)?
install file: no
Would like the custom module to have a libraries file (yes/NO)?
no
Would like the custom module to have a permissions file (yes/NO)?
no
Would like the custom module to have a event subscriber file (yes/NO)?
no
Would like the custom module to have a block plugin file (yes/NO)?
no
Would like the custom module to have a controller file (yes/NO)?
no
Would like the custom module to have a settings form file (yes/NO)?
no
Creating a Drupal module and a Content type named 'Basic Page'.
Create 'cms/modules/project' directory!

 Welcome to d8:module:standard generator!
––––––––––––––––––––––––––––––––––––––––––

 The following directories and files have been created or updated:
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
 • basic_page/basic_page.info.yml
 • basic_page/basic_page.module

Do some renaming magic
Got to: /var/www/public/cms
Enable Drupal module 'basic_page'
 [success] Successfully enabled: basic_page
Clear Drupal caches
 [success] Cache rebuild complete.
Adding Drupal module to Git
Success!!

After this the content type should appear on the dashboard:

Dashboard Page

It has also created and enabled a Drupal Module that allows content to also save to MongoDB:

Modules Page

Links

Additional Drupal Content Type Documentation: https://www.drupal.org/docs/7/understanding-drupal/content-types

Last modifiedFriday, April 30, 2021, 12:00:21 PM UTC
Last authorColin van Eenige
Commit ID4c7a701