Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
menu_migration
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
menu_migration
Merge requests
!16
Issue
#3461691
: Add a YAML Format
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3461691
: Add a YAML Format
issue/menu_migration-3461691:3461691-add-a-yaml
into
4.0.x
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Drupal Lady
requested to merge
issue/menu_migration-3461691:3461691-add-a-yaml
into
4.0.x
10 months ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
Closes
#3461691
0
0
Merge request reports
Compare
4.0.x
4.0.x (base)
and
latest version
latest version
c0d23c9b
1 commit,
10 months ago
1 file
+
54
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/Plugin/menu_migration/Format/YamlFormat.php
0 → 100644
+
54
−
0
Options
<?php
namespace
Drupal\menu_migration\Plugin\menu_migration\Format
;
use
Drupal\Component\Serialization\Yaml
;
use
Drupal\Core\StringTranslation\TranslatableMarkup
;
use
Drupal\menu_migration
\Attribute\MenuMigrationFormat
;
/**
* Provides the YAML import/export Format.
*/
#
[
MenuMigrationFormat
(
id
:
'yaml'
,
label
:
new
TranslatableMarkup
(
'YAML'
)
)]
class
YamlFormat
extends
FormatBase
{
/**
* {@inheritdoc}
*/
public
function
encode
(
array
$menuTree
)
{
return
Yaml
::
encode
(
$menuTree
);
}
/**
* {@inheritdoc}
*/
public
function
decode
(
mixed
$menuTree
)
{
return
Yaml
::
decode
(
$menuTree
);
}
/**
* {@inheritdoc}
*/
public
function
allowedExtensions
()
{
return
[
'yaml'
,
'yml'
];
}
/**
* {@inheritdoc}
*/
public
function
defaultExtension
()
{
return
'yaml'
;
}
/**
* {@inheritdoc}
*/
public
function
mimeType
()
{
// @todo Not sure what the good mimetype is, using text for now.
return
'text/plain'
;
}
}
Loading