Provides demo content for Tide modules.
- Introduction
- Requirements
- Usage
- For developers
The Tide Demo Content module leverages the Yaml Content module to provide default demo content for the Tide modules. It also enables privileged users to import YAML content via Admin UI.
- The Tide Demo Content imports all demo content upon installation.
- It also removes all imported demo content when it is uninstalled.
- Privileged users with the "manually import demo content" permission can import YAML content file via the UI: Admin > Content > Import Demo Content.
- To construct the YAML content file, please refer to the following resources:
The Tide Demo Content module utilises the Yaml Content module to import its own definition of demo content.
- Drush commands of the Yaml Content module module will not recognise demo content defined under the structure of Tide Demo Content, hence they will not import those demo content.
- The Tide Demo Content module will not remove standard YAML content imported by Drush commands of YAML Content module.
- Custom demo content can be defined in the
yourmodule.tide_demo_content.yml
. Each demo content collection can have the following keys:dependencies
declares the requirements of the collection:modules
: list of required modules. If at least one required module is not enabled, the collection will be ignored by Tide Demo Content.collections
: list of demo content collection to be imported before this collection can be imported. If a required collection is missing, this collection will be ignored.
content
declares the list of.content.yml
files of the collection.- Tide Demo Content module will look for
.content.yml
files under the directorydemo_content/content/
of your module to import. - If the
content
key has a directory, everything under that directory will be imported recursively. - All items of the
content
keys will be imported in the same order defined in the collection. - Images and files will be imported from the
demo_content/images
anddemo_content/data_files
directories.
- Tide Demo Content module will look for
The structure of mymodule
:
|- demo_content
| |- content
| |- taxonomy_term
| | |- mymodule.tags.yml
| | |- mymodule.topic.yml
| |- mymodule.extra.content
| |- mymodule.media.content.yml
| |- mymodule.node.content.yml
|- mymodule.info.yml
|- mymodule.install
|- mymodule.module
|- mymodule.tide_demo_content.yml
mymodule.tide_demo_content.yml
mymodule.demo:
dependencies:
modules:
- mymodule
- tide_core
collections:
- tide_demo_content:tide_core.demo
- tide_demo_content:tide_site.demo
content:
- taxonomy_term
- mymodule.media.content.yml
- mymodule.node.content.yml
mymodule.extra_demo:
dependencies:
modules:
- mymodule
- tide_core
collections:
- mymodule:mymodule.demo
content:
- mymodule.extra.content.yml
The mymodule
modules defines 2 demo content collections:
mymodule.demo
- requires 2 modules: mymodule and tide_core.
- depends on 2 demo collections
tide_core.demo
andtide_site.demo
from thetide_demo_content
module. - Tide Demo Content will import the
.content.yml
files ofmymodule.demo
in the following order:- taxonomy_term/*
- mymodule.media.content.yml
- mymodule.node.content.yml
mymodule.extra_demo
- requires 2 modules: mymodule and tide_core.
- depends on and will be imported after
mymodule.demo
- URI Reference: derived from the Reference process plugin. It accepts all
parameters of the
reference
process plugin and returns theuri
of the found entity instead of the ID. This plugin can be used for Link fields or Menu items.
field_external_link:
- uri: https://www.vic.gov.au
title: Victorian Government
field_internal_link:
- '#process':
callback: uri_reference
args:
- node
- type: page
title: Demo Page
title: 'Read more'
hook_tide_demo_content_entity_imported
is invoked after Tide Demo Content imports a demo entity.
- Yaml Content: Nodes Cannot Create Menu Links Automatically
- Yaml Content: Nodes Cannot Create Path Aliases
- Tide Demo Content: the Import Demo Content UI only allows to import YAML content, it does not allow to upload files/images. Hence, entities in the uploaded YAML can only reference existing files/images.