Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
scheduler
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
scheduler
Merge requests
!222
Update scheduler.module.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Update scheduler.module.
issue/scheduler-3500296:3500296-able-to-schedule
into
2.x
Overview
0
Commits
2
Pipelines
2
Changes
1
Open
Karan Garg
requested to merge
issue/scheduler-3500296:3500296-able-to-schedule
into
2.x
4 months ago
Overview
0
Commits
2
Pipelines
2
Changes
1
Expand
The constraints were not executing in a particular scenario.
Closes
#3500296
0
0
Merge request reports
Compare
2.x
version 2
67a91edf
4 months ago
version 1
e4946675
4 months ago
2.x (HEAD)
and
latest version
latest version
67a91edf
2 commits,
4 months ago
version 2
67a91edf
2 commits,
4 months ago
version 1
e4946675
1 commit,
4 months ago
1 file
+
22
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
scheduler.module
+
22
−
0
Options
@@ -805,6 +805,28 @@ function scheduler_entity_base_field_info(EntityTypeInterface $entity_type) {
return
$fields
;
}
/**
* Implements hook_entity_bundle_field_info_alter().
*/
function
scheduler_entity_bundle_field_info_alter
(
&
$fields
,
EntityTypeInterface
$entity_type
,
$bundle
)
{
// This is necessary for content types where the title label is changed from
// the default "Title" to something else. In this case, the field are
// considered a bundle field and the constraint must be added here. This is
// expected (not a Drupal bug).
// Additional info: https://www.drupal.org/project/drupal/issues/3193351.
$entity_types
=
\Drupal
::
service
(
'scheduler.manager'
)
->
getPluginEntityTypes
();
if
(
in_array
(
$entity_type
->
id
(),
$entity_types
))
{
if
(
!
empty
(
$fields
[
'publish_on'
]))
{
$fields
[
'publish_on'
]
->
addConstraint
(
'SchedulerPublishOn'
,
[]);
}
if
(
!
empty
(
$fields
[
'unpublish_on'
]))
{
$fields
[
'unpublish_on'
]
->
addConstraint
(
'SchedulerUnpublishOn'
,
[]);
}
}
}
/**
* Implements hook_action_info_alter().
*/
Loading