Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
points
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
points
Merge requests
!1
Issue
#3244042
: Upgrade for Drupal 9
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Issue
#3244042
: Upgrade for Drupal 9
issue/points-3244042:3244042-upgrade-for-drupal9
into
8.x-1.x
Overview
0
Commits
6
Pipelines
0
Changes
15
Closed
Hillary Lewandowski
requested to merge
issue/points-3244042:3244042-upgrade-for-drupal9
into
8.x-1.x
3 years ago
Overview
0
Commits
6
Pipelines
0
Changes
15
Expand
0
0
Merge request reports
Compare
8.x-1.x
version 5
d3e85f91
3 years ago
version 4
5a42d845
3 years ago
version 3
41ff50c0
3 years ago
version 2
3e2e5bf6
3 years ago
version 1
1381d7d6
3 years ago
8.x-1.x (base)
and
latest version
latest version
6f49e1c1
6 commits,
3 years ago
version 5
d3e85f91
5 commits,
3 years ago
version 4
5a42d845
4 commits,
3 years ago
version 3
41ff50c0
3 commits,
3 years ago
version 2
3e2e5bf6
2 commits,
3 years ago
version 1
1381d7d6
1 commit,
3 years ago
15 files
+
118
−
41
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
15
Search (e.g. *.vue) (Ctrl+P)
src/Controller/EntityPointsMovementController.php
+
9
−
5
Options
@@ -2,6 +2,7 @@
namespace
Drupal\points\Controller
;
use
Drupal
;
use
Drupal\Core\Controller\ControllerBase
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Drupal\Core\Render\Renderer
;
@@ -51,16 +52,20 @@ class EntityPointsMovementController extends ControllerBase {
}
/**
* {@inheritdoc}
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
* Thrown if the entity type doesn't exist.
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* Thrown if the storage handler couldn't be loaded.
* @throws \Exception
*/
public
function
page
()
{
// The current_path should look like /entity_type/entity_id/points.
$current_path
=
\
Drupal
::
service
(
'path.current'
)
->
getPath
();
$current_path
=
Drupal
::
service
(
'path.current'
)
->
getPath
();
$path
=
explode
(
"/"
,
$current_path
);
$entity
=
$this
->
entityTypeManager
->
getStorage
(
$path
[
1
])
->
load
(
$path
[
2
]);
$config_entities
=
\
Drupal
::
entityTypeManager
()
->
getStorage
(
'field_storage_config'
)
->
loadMultiple
();
$config_entities
=
Drupal
::
entityTypeManager
()
->
getStorage
(
'field_storage_config'
)
->
loadMultiple
();
foreach
(
$config_entities
as
$config_entity
)
{
$field_name
=
$config_entity
->
get
(
'field_name'
);
if
(
$config_entity
->
get
(
'type'
)
===
'entity_reference'
&&
$config_entity
->
get
(
'settings'
)[
'target_type'
]
===
'point'
&&
$config_entity
->
get
(
'entity_type'
)
==
$path
[
1
]
&&
substr
(
$field_name
,
6
)
==
$path
[
3
])
{
@@ -72,11 +77,10 @@ class EntityPointsMovementController extends ControllerBase {
$view
=
Views
::
getview
(
'point_movement'
);
$view_render_array
=
$view
->
buildRenderable
(
'embed_1'
,
[
$target_id
]);
$build
=
[
return
[
'#type'
=>
'markup'
,
'#markup'
=>
$this
->
renderer
->
render
(
$view_render_array
)
];
return
$build
;
}
}
Loading