dpc-sdp / tide_demo_content
Create demo content for Tide modules.
Installs: 39 894
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 14
Forks: 5
Open Issues: 5
Type:drupal-module
Requires
- dpc-sdp/tide_core: ^4.0.0
- drupal/yaml_content: ^1.0@alpha
- dev-develop
- 4.1.1
- 4.1.0
- 4.0.0
- 3.0.13
- 3.0.12
- 3.0.11
- 3.0.10
- 3.0.9
- 3.0.8
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 1.1.7
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- dev-reference
- dev-release/4.1.1
- dev-demo-image
- dev-master
- dev-release/4.1.0
- dev-SDPTA-1013-campaign-fix
- dev-demo-fix
- dev-fix-test
- dev-event-menu-remove
- dev-content_collection_new
- dev-new-content-collection-dataset
- dev-release/4.0.0
- dev-feature/SDPAP-8241-add-contributor-users
- dev-SDPTA-947-add-org-demo
- dev-SDPAP-7408-remove-card-event
- dev-release/3.0.13
- dev-release/3.0.12
- dev-release/3.0.11
- dev-feature/R20-956-fix-menu-structure
- dev-R20-896-addpage
- dev-new-image-doc
- dev-replace-melbourne-tram-image
- dev-SDPTA-603-remove-blank-image
- dev-release/3.0.10
- dev-release/3.0.9
- dev-new-grants
- dev-feature/fix-demo-content-menu-errors
- dev-add-content-pt1-pt2
- dev-minimal-content
- dev-test_keith
- dev-release/3.0.7
- dev-release/3.0.6
- dev-change_summary
- dev-test-cc-data-sites
- dev-update-cc-section-name
- dev-release/3.0.4
- dev-add-cc-tags-topics
- dev-feature/fixes_error_where_field_is_not_defined
- dev-feature/cms-improvement-poc-helper
- dev-feature/ignore_filter
This package is auto-updated.
Last update: 2024-10-25 03:07:21 UTC
README
tide_demo_content
Provides demo content for Tide modules.
CONTENTS OF THIS FILE
- Introduction
- Requirements
- Usage
- For developers
INTRODUCTION
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.
REQUIREMENTS
USAGE
- 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:
FOR DEVELOPERS
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
Example
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
Custom Yaml Content process plugins
- 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'
Hooks
hook_tide_demo_content_collection_ignore
is invoked before Tide Demo Content imports demo content collections. It allows other modules to exclude unwanted demo content collections. When a collection is ignored, all its dependants are also automatically ignored due to missing dependencies. Ignoring thetide_demo_content:tide_media.demo
andtide_demo_content:tide_site.demo
will exclude all default demo content from Tide modules except demo users.hook_tide_demo_content_entity_imported
is invoked after Tide Demo Content imports a demo entity.
Known issues
- 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.