Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
block_condition_published
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
block_condition_published
Commits
d6217ac0
Commit
d6217ac0
authored
1 year ago
by
Virendra Singh
Committed by
Nikolay Grachev
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3412884
by viren18febS, AbdeI, clarkssquared: Fix the issues reported by phpcs
parent
5991600d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+4
-2
4 additions, 2 deletions
README.md
src/Plugin/Condition/NodePublishedState.php
+3
-5
3 additions, 5 deletions
src/Plugin/Condition/NodePublishedState.php
with
7 additions
and
7 deletions
README.md
+
4
−
2
View file @
d6217ac0
...
...
@@ -28,9 +28,11 @@ A module that provides a condition plugin for blocks.
Allows to display block on pages depending on publishing status of the node.
For example, a block can be shown for editors on unpublished pages only.
Supports both classic _Published/Unpublished_ status and workflows (_Review, Draft..._ etc.) as well.
Supports both classic _Published/Unpublished_ status and workflows
(_Review, Draft..._ etc.) as well.
In case of workflows, all states such as _Draft, Unpublished, Review..._ are treated as unpublished,
In case of workflows, all states such as _Draft, Unpublished, Review..._
are treated as unpublished,
state _Published_ is treated as published content.
...
...
This diff is collapsed.
Click to expand it.
src/Plugin/Condition/NodePublishedState.php
+
3
−
5
View file @
d6217ac0
...
...
@@ -2,7 +2,6 @@
namespace
Drupal\block_condition_published\Plugin\Condition
;
use
Drupal\Core\Condition\Annotation\Condition
;
use
Drupal\Core\Condition\ConditionPluginBase
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Drupal\Core\Form\FormStateInterface
;
...
...
@@ -11,7 +10,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Provides a 'Node Published State' condition.
*
* @Condition(
* id = "node_published_state",
* label = @Translation("Node published state"),
...
...
@@ -126,9 +125,8 @@ class NodePublishedState extends ConditionPluginBase implements ContainerFactory
$node_revision
=
$node_storage
->
loadRevision
(
$vid
);
// @todo more info about revisions:
// https://www.phase2technology.com/blog/getting-correct-node
// https://drupal.stackexchange.com/questions/264674/what-is-the-default-revision
// https://www.phase2technology.com/blog/getting-correct-node
// https://drupal.stackexchange.com/questions/264674/what-is-the-default-revision
return
$node_revision
->
get
(
'status'
)
->
value
==
$this
->
configuration
[
'is_published'
];
}
...
...
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