Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
workflow
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
workflow
Commits
f77831e1
Commit
f77831e1
authored
2 weeks ago
by
John Voskuilen
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3515981
: Apply new orderby key to configuration schema for WorkflowState - undo
parent
eb8043c3
No related branches found
No related tags found
No related merge requests found
Pipeline
#459755
passed with warnings
2 weeks ago
Stage: build
Stage: validate
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/schema/workflow.state.schema.yml
+0
-1
0 additions, 1 deletion
config/schema/workflow.state.schema.yml
src/Entity/WorkflowState.php
+18
-1
18 additions, 1 deletion
src/Entity/WorkflowState.php
with
18 additions
and
2 deletions
config/schema/workflow.state.schema.yml
+
0
−
1
View file @
f77831e1
...
...
@@ -3,7 +3,6 @@
workflow.state.*
:
type
:
config_entity
label
:
'
Workflow
State'
orderby
:
weight
mapping
:
id
:
type
:
string
...
...
This diff is collapsed.
Click to expand it.
src/Entity/WorkflowState.php
+
18
−
1
View file @
f77831e1
...
...
@@ -242,8 +242,9 @@ class WorkflowState extends ConfigEntityBase implements WorkflowStateInterface {
* @_deprecated WorkflowState::getStates() ==> WorkflowState::loadMultiple()
*/
public
static
function
loadMultiple
(
array
$ids
=
NULL
,
$wid
=
''
,
$reset
=
FALSE
)
{
// Loaded States are
already
sorted via 'orderby: weight' in schema file.
//
@todo
Loaded States are sorted via 'orderby: weight' in schema file.
$states
=
parent
::
loadMultiple
();
usort
(
$states
,
[
'Drupal\workflow\Entity\WorkflowState'
,
'sort'
]);
// Filter on Wid, if requested, E.g., by Workflow->getStates().
// Set the ID as array key.
...
...
@@ -257,6 +258,22 @@ class WorkflowState extends ConfigEntityBase implements WorkflowStateInterface {
return
$result
;
}
/**
* {@inheritdoc}
*/
public
static
function
sort
(
ConfigEntityInterface
$a
,
ConfigEntityInterface
$b
)
{
/** @var \Drupal\workflow\Entity\WorkflowState $a */
/** @var \Drupal\workflow\Entity\WorkflowState $b */
$a_wid
=
$a
->
getWorkflowId
();
$b_wid
=
$b
->
getWorkflowId
();
if
(
$a_wid
==
$b_wid
)
{
$a_weight
=
$a
->
getWeight
();
$b_weight
=
$b
->
getWeight
();
return
(
$a_weight
<
$b_weight
)
?
-
1
:
1
;
}
return
(
$a_wid
<
$b_wid
)
?
-
1
:
1
;
}
/**
* Deactivate a Workflow State, moving existing content to a given State.
*
...
...
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