Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rdf_sync
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
rdf_sync
Merge requests
!26
Handle publication status of entities that have a published flag.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Handle publication status of entities that have a published flag.
issue/rdf_sync-3478179:3478179-allow-to-check
into
1.x
Overview
5
Commits
18
Pipelines
9
Changes
16
4 unresolved threads
Hide all comments
Merged
Ilias Dimopoulos
requested to merge
issue/rdf_sync-3478179:3478179-allow-to-check
into
1.x
7 months ago
Overview
5
Commits
18
Pipelines
9
Changes
16
4 unresolved threads
Hide all comments
Expand
Handle publication status of viable entities.
Closes
#3478179
0
0
Merge request reports
Compare
1.x
version 8
6376a262
7 months ago
version 7
e22093b5
7 months ago
version 6
4bbe7484
7 months ago
version 5
6f22d997
7 months ago
version 4
cf101626
7 months ago
version 3
0a0443e1
7 months ago
version 2
a69cf09a
7 months ago
version 1
5dc86fef
7 months ago
1.x (base)
and
latest version
latest version
6376a262
18 commits,
7 months ago
version 8
6376a262
18 commits,
7 months ago
version 7
e22093b5
17 commits,
7 months ago
version 6
4bbe7484
15 commits,
7 months ago
version 5
6f22d997
14 commits,
7 months ago
version 4
cf101626
10 commits,
7 months ago
version 3
0a0443e1
9 commits,
7 months ago
version 2
a69cf09a
4 commits,
7 months ago
version 1
5dc86fef
3 commits,
7 months ago
16 files
+
235
−
12
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
16
Search (e.g. *.vue) (Ctrl+P)
modules/rdf_sync_published/src/EventSubscriber/RdfSyncPublishedSubscriber.php
0 → 100644
+
40
−
0
Options
<?php
declare
(
strict_types
=
1
);
namespace
Drupal\rdf_sync_published\EventSubscriber
;
use
Drupal\Core\Entity\EntityPublishedInterface
;
use
Drupal\rdf_sync
\Event\RdfSyncEvent
;
use
Symfony\Component\EventDispatcher\EventSubscriberInterface
;
/**
* Listens to the event before syncing the entities.
*/
class
RdfSyncPublishedSubscriber
implements
EventSubscriberInterface
{
/**
* {@inheritdoc}
*/
public
static
function
getSubscribedEvents
():
array
{
return
[
RdfSyncEvent
::
class
=>
'filterOutUnpublished'
,
];
}
/**
* Filters out unpublished entities.
*
* @param \Drupal\rdf_sync\Event\RdfSyncEvent $event
* The event object.
*/
public
function
filterOutUnpublished
(
RdfSyncEvent
$event
):
void
{
$entities
=
$event
->
getEntities
();
// Do not filter out entities that do not implement
// EntityPublishedInterface as we cannot determine their publication
// status and might filter out entities that should be synced.
$entities
=
array_filter
(
$entities
,
fn
(
$entity
):
bool
=>
!
$entity
instanceof
EntityPublishedInterface
||
$entity
->
isPublished
());
$event
->
setEntities
(
$entities
);
}
}
Loading