Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Release: ServiceM8 Webform Integration 1.2.1 — Minor update available for module servicem8_webform (1.2.1). Release: PostfixAdmin 1.0.0 — Initial release available for module postfix_admin (1.0.0)! Release: ip_analyser 1.0.3 — Minor update available for module ip_analyser (1.0.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

Entity Custom Base Field

No security coverage

Part of the Entity ecosystem · 235 projects

View on drupal.org

Creating base fields are usable when we need to create them at one place & this field would get shared across all the bundles of an entity type. Thus in place of having to create fields separately by going into each of the bundles e.g. Content types, we can create them at one place and it gets available to all. Since base fields don't create extra tables in database as compared to creating fields from the UI, it becomes more convenient & manageable to get the data from the base field tables.

Features

This module provides a functionality to create base fields for entity types from the admin configuration UI.

Currently the modules supports adding base fields for the following entity types:

  • Content Block
  • Content
  • Taxonomy Term
  • User

The following types of base fields can be added into the above entity types as of now:

  • Boolean
  • Text (plain)
  • Text (plain, long)
  • Text (formatted)
  • Text (formatted, long)
  • Text (formatted, long, with summary)

Configuration

Configure the entity custom base field at (/admin/config/entity_custom_base_field):

Usage

Creating new base fields:

  • Navigate to the configuration page which the module provides under System > Configuration > Entity Custom Base Field > Entity Custom Base Field Configuration.

    Select the Entity Type & Field Type for which a base field needs to be added. Add a Machine Name, Field Label & Field Description.

    Save the form & it should create the base field and show up a table where the new field information will be available.

  • To verify whether the field has been created successfully, navigate to a entity add/edit page for the particular entity type & check for the newly created field being displayed. Also verify by checking the database table to see a new column being added to the base table for the entity type, e.g. if a base field (say field_new_boolean) is added for Content, then a new column with the same name should be visible if we inspect the structure of node_field_data table in our database.

Deleting created fields:

  • Once a base field is added, we will start to see a link Delete under the Operation column under each field row on the admin configuration page. Click on the link which opens a confirmation form which deletes the field and all associated data from database on confirming the same.

Exporting and Importing base fields:

Once we create base fields from our local system, we may need to get the same created to our DEV/other environments. To achieve the same we need to follow the below steps:

  • The module stores the base field configuration under a config entity_custom_base_field.settings. Whenever we create new fields, we would need to take a config export which would add up the new field details in the config & commit this file in version control.
  • When our code is deployed on the environment where we need to import these fields, we would need to open up the admin configuration form (/admin/config/entity_custom_base_field/settings) over which the fields which need to be imported will be listed with a link to import them on the right.

    Click on Import to open a confirmation form & accept the same to get all the fields created in the environment.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Aug 2024
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Dormant

Releases

Version Type Core Release date
1.0.0 Stable Aug 9, 2024
1.0.x-dev Dev Aug 9, 2024