Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
yaml_content
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
yaml_content
Commits
710e149a
Commit
710e149a
authored
1 year ago
by
Manoj Raj
Committed by
Damien McKenna
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3320034
by Manoj Raj.R, nitapawar, DamienMcKenna: Replace README.txt with README.md format.
parent
b4b41d5d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+59
-44
59 additions, 44 deletions
README.md
with
59 additions
and
44 deletions
README.
txt
→
README.
md
+
59
−
44
View file @
710e149a
-- Summary --
# YAML Content
The YAML Content module provides a framework for defining content in a
human-readable and writable YAML structure allowing for the flexible
and straight-forward creation of demo content within a site.
-- REQUIREMENTS --
No additional modules are explicitly required for yaml_content to function.
## Requirements
-- INSTALLATION --
No additional modules are required for YAML Content to function.
* Install as usual, see https://www.drupal.org/documentation/install/modules-themes/modules-8
for further information.
-- SETUP --
## Installation
Install as you would normally install a contributed Drupal module. For further
information, see
[
Installing Drupal Modules
](
https://www.drupal.org/docs/extending-drupal/installing-drupal-modules
)
.
## Configuration
No configuration is provided in the UI.
Recommended setup for the module is to determine a target location for import
content to be found. Most accessibly, this could be within either an enabled
...
...
@@ -24,7 +29,8 @@ subdirectory and follow the naming convention `*.content.yml`. Referenced images
or data files may also be added in parallel directories named
`images/`
and
`data_files`
respectively.
-- USAGE --
## Usage
To assist determining YAML structure for entities and fields, looking at the
structure within the corresponding entity_view_display configuration file is a
...
...
@@ -33,11 +39,12 @@ good place to start.
Once content is created for import, it may be imported through the one of the
custom Drush commands:
- `drush yaml-content-import <directory>`
- `drush yaml-content-import-module <module_name>`
- `drush yaml-content-import-profile <profile_name>`
drush yaml-content-import <directory>
drush yaml-content-import-module <module_name>
drush yaml-content-import-profile <profile_name>
-- EXAMPLES --
## Examples
For some brief content examples, have a look in the
`content`
folder of this
module. In that folder there are example import files with inline commentary
...
...
@@ -51,39 +58,47 @@ following command through Drush:
drush yaml-content-import-module yaml_content
-- INSTALLATION PROFILE USAGE --
## Installation profile usage
To trigger loading content during an installation profile just add an install
task.
/**
* Implements hook_install_tasks().
*/
function MYPROFILE_install_tasks(&$install_state) {
$tasks = [
// Install the demo content using YAML Content.
'MYPROFILE_install_content' => [
'display_name' => t('Install demo content'),
'type' => 'normal',
],
];
return $tasks;
}
/**
* Callback function to install demo content.
*
* @see MYPROFILE_install_tasks()
*/
function MYPROFILE_install_content() {
// Create default content.
$loader = \Drupal::service('yaml_content.load_helper');
$loader->importProfile('MYPROFILE');
// Set front page to the page loaded above.
\Drupal::configFactory()
->getEditable('system.site')
->set('page.front', '/home')
->save(TRUE);
}
/**
* Implements hook_install_tasks().
*/
function MYPROFILE_install_tasks(&$install_state) {
$tasks = [
// Install the demo content using YAML Content.
'MYPROFILE_install_content' => [
'display_name' => t('Install demo content'),
'type' => 'normal',
],
];
return $tasks;
}
/**
* Callback function to install demo content.
*
* @see MYPROFILE_install_tasks()
*/
function MYPROFILE_install_content() {
// Create default content.
$loader = \Drupal::service('yaml_content.load_helper');
$loader->importProfile('MYPROFILE');
// Set front page to the page loaded above.
\Drupal::configFactory()
->getEditable('system.site')
->set('page.front', '/home')
->save(TRUE);
}
## Maintainers
-
[
Damien McKenna
](
https://www.drupal.org/u/damienmckenna
)
-
Mark Shropshire -
[
shrop
](
https://www.drupal.org/u/shrop
)
-
Stephen Lucero -
[
slucero
](
https://www.drupal.org/u/slucero
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment