Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
default_content
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
6
Merge Requests
6
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
default_content
Commits
c914f043
Commit
c914f043
authored
Feb 17, 2016
by
larowlan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request
#53
from andypost/8.x-1.x-export-all
Export all option
parents
4a484537
2ba10aa7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
drush/default_content.drush.inc
drush/default_content.drush.inc
+14
-6
src/DefaultContentManager.php
src/DefaultContentManager.php
+2
-1
No files found.
drush/default_content.drush.inc
View file @
c914f043
...
...
@@ -31,7 +31,7 @@ function default_content_drush_command() {
'folder'
=>
dt
(
'Folder to export to, entities are grouped by entity type into directories.'
),
],
'aliases'
=>
[
'dcer'
],
'required-arguments'
=>
2
,
'required-arguments'
=>
1
,
];
$items
[
'default-content-export-module'
]
=
[
'description'
=>
dt
(
'Exports all the content defined in a module info file.'
),
...
...
@@ -72,16 +72,24 @@ function drush_default_content_export($entity_type_id, $entity_id) {
* @param string $entity_type_id
* The entity type ID.
* @param mixed $entity_id
*
The entity ID to export
.
*
(Optional) The entity ID to export or all entities will be exported
.
*/
function
drush_default_content_export_references
(
$entity_type_id
,
$entity_id
)
{
function
drush_default_content_export_references
(
$entity_type_id
,
$entity_id
=
NULL
)
{
/** @var \Drupal\default_content\DefaultContentManagerInterface $manager */
$manager
=
\
Drupal
::
service
(
'default_content.manager'
);
$folder
=
drush_get_option
(
'folder'
,
'.'
);
$serialized_by_type
=
$manager
->
exportContentWithReferences
(
$entity_type_id
,
$entity_id
);
$manager
->
writeDefaultContent
(
$serialized_by_type
,
$folder
);
if
(
is_null
(
$entity_id
)
&&
(
$entities
=
\
Drupal
::
entityQuery
(
$entity_type_id
)
->
execute
()))
{
// @todo Add paging.
foreach
(
$entities
as
$entity_id
)
{
$serialized_by_type
=
$manager
->
exportContentWithReferences
(
$entity_type_id
,
$entity_id
);
$manager
->
writeDefaultContent
(
$serialized_by_type
,
$folder
);
}
}
else
{
$serialized_by_type
=
$manager
->
exportContentWithReferences
(
$entity_type_id
,
$entity_id
);
$manager
->
writeDefaultContent
(
$serialized_by_type
,
$folder
);
}
}
/**
...
...
src/DefaultContentManager.php
View file @
c914f043
...
...
@@ -338,7 +338,8 @@ class DefaultContentManager implements DefaultContentManagerInterface {
if
(
$dependent_entity
instanceof
ConfigEntityInterface
)
{
unset
(
$entity_dependencies
[
$id
]);
}
else
{
elseif
(
!
isset
(
$entity_dependencies
[
$id
]))
{
// Prevent loops.
$entity_dependencies
=
array_merge
(
$entity_dependencies
,
$this
->
getEntityReferencesRecursive
(
$dependent_entity
,
$depth
+
1
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment