🇪🇸
Drupal Documentation and Guides
Guides
Spanish
Spanish
  • Getting Started with Drupal
  • Installing Drupal
  • Drush
  • Theme & Module Development Concepts
  • Modules
  • Themes
  • FrontEnd
    • Javascript
  • Backend
    • Helpful Drupal Classes and Methods
    • Entities
    • Nodes
    • Taxonomies
    • Hooks
    • Twig
    • Libraries
    • Queries
    • Forms
    • Files & Images
    • Helpful functions and solutions
  • Guides
    • Custom Fields
      • Entity Reference and integer
      • Two Text Fields
      • Textfields, formatted text and numbers
      • Links and media elements
Powered by GitBook
On this page
  1. Guides

Custom Fields

PreviousHelpful functions and solutionsNextEntity Reference and integer

Last updated 2 years ago

Sometimes you need to create your own custom fields or group of fields to your models. This is a guide on how to do that. Although there is an example at the module, i found it lacking in some areas. So i decided to create my own example.

We will be leveraging the to create our custom fields. which means we will need to create a FieldType, FieldWidget and FieldFormatter. we will create these files in the src/Plugin/Field/FieldType, src/Plugin/Field/FieldWidget and src/Plugin/Field/FieldFormatter directories.

Examples for developers
Field API
Entity Reference and integer
Two Text Fields
Textfields, formatted text and numbers
Links and media elements