Welcome to Drupal Entity Generator (DEG) documentation!
Introduction
Drupal Entity Generator (DEG) is a tool used to build Drupal entities using the architecture defined in the Google spreadsheet. It provides drush commands to generate the following entity types:
Entity Types
Content types
Fields
Vocabularies
Block
Menus
Image styles
Image effects
Workflows
Workflow states
Workflow transitions
User roles
Media Types
Paragraphs
By using this tool we can manage the entities of Drupal projects, based on structure defined in Google spreadsheet. It saves our time and improve the productivity of team.
About DEG Spreadsheet
DEG Spreadsheet is a Google Spreadsheet template used for capturing structure of entities, Use DEG sample template for creation of new Google spreadsheet with same structure to generate different Drupal entities as per requirements.
Overview
This sheet is used to keep track of numbers of entities used in different sheets.
Column |
Specifications |
---|---|
Specification |
List of different entity sheets |
Done |
Number of entities(rows) ‘Implemented and done(x)’ as per status of column X of that sheet. |
Total |
Number of entities(rows) defined. |
% |
Percentage of entities(rows) ‘Implemented and done(x)’. |
Bundles
A list of bundles of different entity types in Drupal.
Column |
Creation support |
Update support |
Specifications |
---|---|---|---|
ID |
No |
No |
An optional identifier for references in external documents. |
Name |
Yes |
Yes |
To keep name of entity types like Article, Page etc. |
Machine name |
Yes |
No |
Unique machine name for Drupal bundles. |
X |
Yes |
Yes |
Implementation status for bundles, a = Approved and ready to implement , w = Wait to implement, x = Implemented and done, - c = Changed since implemented, d = To be deleted |
Dev |
No |
No |
Developer initials, signifying that the row has been implemented as specified. |
QA |
No |
No |
Tester initials, signifying that the row has been validated. |
Description |
Yes |
Yes |
Description about the bundles. |
Example(s) |
No |
No |
One or more relevant examples, optionally hyperlinked. |
Mod. |
No |
No |
Moderated (Content moderation is enabled), for example: y = Yes, n = No |
Layout |
No |
No |
Layout-enabled, via Core Layout Builder or via Panels, for example: y = Yes, n = No |
Trns. |
No |
No |
Translatable, for example: y = Yes, n = No |
Migr. |
No |
No |
Migrated (Content will be populated via migration) |
Cmnt. |
No |
No |
Commenting is enabled, for example: y = Yes, n = No |
Meta. |
No |
No |
Meta tags are enabled, for example: y = Yes, n = No |
Sched. |
No |
No |
Schedulable (Scheduled updates are enabled), for example: y = Yes, n = No |
Type |
Yes |
No |
Entity type, for example: Content type, Vocabulary, Paragraph type, Media type, Custom block type |
URL alias pattern |
Yes |
No |
To configure URL alias pattern. |
Settings/notes |
Yes |
No |
To configure settings/notes related to bundle, for example: ‘Image’ for media type image |
Fields
A list for fields which is required for bundles.
Column |
Creation support |
Update support |
Specifications |
---|---|---|---|
Bundle |
Yes |
No |
Name of bundles like Article (Content type), Page (Content type) etc. |
Field label |
Yes |
Yes |
Field label of fields. |
Machine name |
Yes |
No |
Unique machine name for Drupal bundles, (use prefix + underscore: ‘field + underscore’ for field, for ‘group + underscore’ for group type fields) |
X |
Yes |
Yes |
Implementation status for bundles, a = Approved and ready to implement , w = Wait to implement, x = Implemented and done, - c = Changed since implemented, d = To be deleted |
Dev |
No |
No |
Developer initials, signifying that the row has been implemented as specified. |
QA |
No |
No |
Tester initials, signifying that the row has been validated. |
Field group |
Yes |
Yes |
Field group to which field comes |
Field type |
Yes |
No |
To define field type like Text (formatted, long), Text (plain) etc. |
Ref. bundle |
Yes |
No |
Reference of bundle, for example: Article categories (Vocabulary) |
Req |
Yes |
Yes |
Is field mandatory or not, for example: y = Yes, n = No |
Vals. |
Yes |
Yes |
Allowed number of values, Asterisk (*) means unlimited, for example: 1, 2, 3 |
Form widget |
Yes |
No |
To define field Form widget, like Text area (multiple rows), Textfield |
Trns. |
No |
No |
Translatable, for example: y = Yes, n = No |
Settings/notes |
Yes |
No |
To configure settings/notes related to bundle, for example: ‘Image’ for media type image |
Help text |
Yes |
Yes |
Notes about the field |
User roles
Defines a list of user roles in Drupal.
Column |
Creation support |
Update support |
Specifications |
---|---|---|---|
ID |
No |
No |
An optional identifier for references in external documents. |
Name |
Yes |
Yes |
To keep name of user roles like Administrators, Content Editor, Content Manager etc. |
Machine name |
Yes |
No |
Unique machine name for Drupal bundles. |
X |
Yes |
Yes |
Implementation status for bundles, a = Approved and ready to implement , w = Wait to implement, x = Implemented and done, - c = Changed since implemented, d = To be deleted |
Dev |
No |
No |
Developer initials, signifying that the row has been implemented as specified. |
QA |
No |
No |
Tester initials, signifying that the row has been validated. |
Notes |
No |
No |
Notes about the field |
Workflows
Defines a list of Drupal Workflows types.
Column |
Creation support |
Update support |
Specifications |
---|---|---|---|
ID |
No |
No |
An optional identifier for references in external documents. |
Label |
Yes |
Yes |
To keep name of Drupal workflow like Editorial, Administrator etc. |
Machine name |
Yes |
No |
Unique machine name for Drupal bundles. |
X |
Yes |
Yes |
Implementation status for bundles, a = Approved and ready to implement , w = Wait to implement, x = Implemented and done, - c = Changed since implemented, d = To be deleted |
Dev |
No |
No |
Developer initials, signifying that the row has been implemented as specified. |
QA |
No |
No |
Tester initials, signifying that the row has been validated. |
Type |
Yes |
No |
Workflow type Content Moderation |
Notes |
No |
No |
Notes on workflow |
Workflow states
Defines a list of Workflow states for workflows.
Column |
Creation support |
Update support |
Specifications |
---|---|---|---|
Workflow |
Yes |
No |
Defines name of Workflow like Editorial, Administrator etc. |
Label |
Yes |
Yes |
To keep name of Drupal workflow state like Draft, In review, Published etc. |
Machine name |
Yes |
No |
Unique machine name for Drupal bundles. |
X |
Yes |
Yes |
Implementation status for bundles, a = Approved and ready to implement , w = Wait to implement, x = Implemented and done, - c = Changed since implemented, d = To be deleted |
Dev |
No |
No |
Developer initials, signifying that the row has been implemented as specified. |
QA |
No |
No |
Tester initials, signifying that the row has been validated. |
Notes |
No |
No |
Notes on workflow states |
Workflow transitions
Defines a list of Workflow transitions.
Column |
Creation support |
Update support |
Specifications |
---|---|---|---|
ID |
No |
No |
An optional identifier for references in external documents. |
Workflow |
Yes |
No |
Name of Workflow like Editorial, Administrator etc. |
Label |
Yes |
Yes |
Name of Workflow transitions like Create New Draft, Send to review, Send to Publish etc. |
Machine name |
Yes |
No |
Unique machine name for Drupal bundles. |
X |
Yes |
Yes |
Implementation status for bundles, a = Approved and ready to implement , w = Wait to implement, x = Implemented and done, - c = Changed since implemented, d = To be deleted |
From state |
Yes |
No |
From state, example Draft, In review, Published etc. |
To state |
Yes |
No |
To state, example Draft, In review, Published etc. |
Dev |
No |
No |
Developer initials, signifying that the row has been implemented as specified. |
QA |
No |
No |
Tester initials, signifying that the row has been validated. |
Notes |
No |
No |
Notes on workflow states |
Image styles
Defines a list of image styles in Drupal.
Column |
Creation support |
Update support |
Specifications |
---|---|---|---|
Style name |
Yes |
Yes |
Name of image style name like Crop thumbnail, Thumbnail (100×100), Medium (220×220), Large (480×480) etc. |
Machine name |
Yes |
No |
Unique machine name for Drupal bundles. |
X |
Yes |
Yes |
Implementation status for bundles, a = Approved and ready to implement , w = Wait to implement, x = Implemented and done, - c = Changed since implemented, d = To be deleted |
Notes |
No |
No |
Notes on workflow states |
Image effects
Defines a list of image style effects in Drupal.
Column |
Creation support |
Update support |
Specifications |
---|---|---|---|
Image style |
Yes |
No |
Name of image style name like Crop thumbnail, Thumbnail (100×100), Medium (220×220), Large (480×480) etc. |
Effect |
Yes |
No |
Image style effects, example- Scale, Manual crop etc. |
X |
Yes |
No |
Implementation status for bundles, a = Approved and ready to implement , w = Wait to implement, x = Implemented and done, - c = Changed since implemented, d = To be deleted |
Summary |
Yes |
No |
Summary about image style effects like width, height of image, example - width 400, uses Freeform crop type, 480×480 |
Notes |
No |
No |
Notes on workflow states |
Installation
Using composer is the preferred way of managing your modules and themes as composer handles dependencies automatically and there is less margin for error. You can find out more about composer and how to install it here: https://getcomposer.org/. It is not recommended to edit your composer.json file manually.
Download using composer
Add Github repository source in you project composer.json. Add below is snippet under repositories
in composer.json:
"acquia-pso": {
"url": "https://github.com/acquia-pso/dst-entity-generate.git",
"type": "git"
}
More information on adding repository can found at Modifying Repositories
Open up your terminal and navigate to your project root directory. Run the following command to require the module:
composer require acquia-pso/dst-entity-generate
DST Entity Generate module will install along with several module dependencies from drupal.org.
Important
In installation, you may need to provide a token.
You need to create a token in your github account.
You can now enable the modules via drush with the following commands:
drush pm:enable dst_entity_generate -y
Create a Google spreadsheet for defining all drupal entities like DEG sample template
Obtaining Google OAuth 2.0 Client Credentials
Go to Google Cloud Platform and create new project

After project creation, make sure your created project is selected.

Then navigate to OAuth consent screen.

Select User type to `Internal` and Click on `Create`.

Provide required information on App Registration Page and click on `SAVE AND CONTINUE`.

On `Scopes` step, no need to configure anything. Just click on `SAVE AND CONTINUE`.
Now, Click on `Credentials` tab to generate OAuth Credentials.

Click on `+ CREATE CREDENTIALS` button and select `Oauth client ID`.

Select Application type as `Desktop app`, provide appropriate name and click on `CREATE`.

Download created credentials.

Enable Google Sheets APIS AND SERVICES
Navigate to `APIs & Services` Dashboard.

Click on `+ ENABLE APIS AND SERVICES` button.

Select “Google Sheets API” and “Enable” it.
Configure DEG on Drupal
Important
Private file system should be configured before configuring DEG.
To configure Private file system, refer Private file path section in settings.php file to configure it.
Login as Administrator on site
Go to menu Configuration -> Development -> Drupal Spec tool: Entity Generate -> Google Sheet API (/admin/config/dst_entity_generate/settings/google_sheet_api)
Enter Application Name. This name can be anything. Not necessary it should same as we created in Google Cloud platform in previous step.
Enter Google Sheets ID.
Upload Client Secret file that we downloaded in earlier steps.

Click on Next.
To complete step two, you need to valid your email account so that, it will be able to fetch data from Google Sheets.
Click on Click here link.
Select or login with Acquia email ID.
Allow permission to View your Google Spreadsheets.
Copy provided code and paste it in Step two form and submit.
It will redirect to General Settings (/admin/config/dst_entity_generate/settings) where we can enable the entity types.
Note
See Recent log messages of Drupal if any errors occur.
Drush Commands
A list of Drush commands used to generate the drupal entities in Drupal using Drupal Entity Generator (DEG) Spreadsheet ,
Generate All Entities
Description
Runs all DEG drush commands together.
Command
deg:generate
Aliases
deg:generate:all
,deg:ga
Options
--update
Update existing entity types with fields and creates new if not present.
Generate Content Types
Description
This command is used to generate content types with fields.
Command
deg:generate:content_types
Aliases
deg:content_types
,deg:ct
Options
--update
Update existing entity types with fields and creates new if not present.
Generate vocabularies
Description
This command is used to generate vocabularies with fields in Drupal.
Command
deg:generate:vocabs
Alias
deg:v
Options
--update
Update existing Vocabulary types with fields and creates new if not present.
Generate Blocks Types
Description
This command is used to generate custom block types with fields in Drupal.
Command
deg:generate:custom_block_type
Alias
deg:cbt
Options
--update
Update existing entity types with fields and creates new if not present.
Generate Image Styles
Description
This command is used to generate image styles and image effects in Drupal.
Command
deg:generate:imagestyle
Alias
deg:is
Options
--update
Update existing image styles and creates new if not present.
Generate Media Types
Description
This command is used to generate media types with fields in Drupal.
Command
deg:generate:media
Alias
deg:media
Options
--update
Update existing entity types with fields and creates new if not present.
Generate Paragraphs Types
Description
This command is used to generate paragraph types with fields in Drupal.
Command
deg:generate:paragraphs
Aliases
deg:para
,deg:p
Options
--update
Update existing entity types with fields and creates new if not present.
Generate User Roles
Description
This command is used to generate user roles in Drupal.
Command
deg:generate:user-roles
Alias
deg:ur
Options
--update
Update existing User roles and creates new if not present.
Generate Workflows
Description
This command is used to generate workflows, states and workflow transitions in Drupal.
Command
deg:generate:workflow
Alias
deg:w
Options
--update
Update existing Workflow types and creates new if not present.
Note
The following messages can come after execution of the command.
- [OK]: means entity has been created successfully.
Example - [OK] Node Type article is successfully created..
- [notice]: means field is created successfully.
Example - [notice] Field storage created for field_teaser_title.
- [WARNING]: means there is some minor error comes on execution of command.
Example - [WARNING] Alias for article is already present, skipping.
[ERROR]: means there is some major error which is halting the execution of command.
Supported Entities
DEG tool supports basic and most required entities generation that is required in mostly all projects. Refer below list of supported entity generation.
Bundles
A list of bundles that DEG can generate.
Block types |
Content types |
Media types |
Paragraph types |
Vocabularies |
Fields
A list for fields that DEG can generate.
Boolean |
Color |
Date |
Date range |
Link |
Accordion |
Accordion Item |
Details |
Fieldset |
HTML element |
Tab |
Tabs |
List (float) |
List (integer) |
Number (decimal) |
Number (float) |
Number (integer) |
Telephone number |
Entity reference |
File |
Image |
Text (plain) |
Text (plain, long) |
Text (formatted) |
Text (formatted, long) |
Text (formatted, long, with summary) |
List (text) |
Form field widgets
A list of field widgets that DEG can generate.
Textfield |
Text area with a summary |
Text area (multiple rows) |
Select list |
Date and time range |
Date and time |
Color boxes |
Color spectrum |
Color HTML5 |
Color default |
Color grid |
Telephone number |
Autocomplete |
Autocomplete (Tags style) |
Image |
Single on/off checkbox |
Number field |
Check boxes/radio buttons |
File |
Site Studio layout canvas |
Link |
Other entities
A list of Drupal entity types that DEG can generate.
User roles |
Workflows |
Workflow states |
Workflow trasnsitions |
Menu |
Image styles |
Image effects |
References
We have used Drupal Spec Tool as reference for creation of DEG Google spreadsheet template.