DE EN EN (Google)

Custom Data Type

A custom data type can be used to extends easydb with your own data type. A custom data type can store any data in a JSON-Map. The Input, Output and Search-Mapping of that type can be managed by plugin code.

An example for a custom data type is Web link or the Remote Plugin both provided by Programmfabrik and made open source on Github.

custom_types:
  link:
    config:
      schema:
        - name: title
          parameters:
            type:
              type: select
              options: ["none", "text", "text-l10n"]
        - name: add_timestamp
          parameters:
            value:
              type: bool
      mask:
        - name: editor_style
          parameters:
            value:
              type: select
              options: ["inline",  "popover"]
    mapping:
      url:
        type: text_oneline
      text_plain:
        type: text
      tld:
        type: text
      text:
        type: text_l10n_oneline

Search-Mapping

The search mapping for the fields of the custom data type can be defined in the plugin configuration. Under the node mapping, the field names and their type can be defined:

Types that can be specified are:

JSON Definition

The plugin generates a JSON object that is saved in the database. The frontend uses the information in the object to display the custom data type.

{
    "url": "https://docs.easydb.de",
    "tld": "de",
    "hostname": "docs.easydb.de",
    "text": {
        "de-DE": "Welcome to the easydb documentation",
        "en-US": "Willkommen zur easydb-Dokumentation"
    },
    "_fulltext": {
        "string": "https://docs.easydb.de",
        "l10ntext": {
            "de-DE": "Welcome to the easydb documentation",
            "en-US": "Willkommen zur easydb-Dokumentation"
        }
    },
    "_standard": {
        "l10ntext": {
            "de-DE": "Welcome to the easydb documentation",
            "en-US": "Willkommen zur easydb-Dokumentation"
        }
    }
}

This example shows the content of the JSON definition of the custom data type Weblink.

General Keys

_fulltext

This is used to add the content of the plugin to the elasticsearch index. The content of these fields is copied to _all_text and _all_string fields and can be found in the fulltext search.

_standard

Custom Data Types can define their own standard, that is parsed by the server and is displayed in the frontend. The standard definition is part of the json object that is generated by the plugin.

Two different standard versions can be saved:

Custom Data Type specific Keys

The JSON object can contain multiple extra fields that contain data and information and is interpreted by the plugin. For example, the Weblink Custom Data Type Plugin contains the following fields:

Automatic updates of custom data types

The server can automatically update Custom Data Types (especially Custom Data Types that get their data from external sources), if the plugin provides an update script.

For more details, see Automatic updates of custom data types