Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Merge requests
!1491
Add a "Manage permissions" tab for each bundle that has associated permissions
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Add a "Manage permissions" tab for each bundle that has associated permissions
issue/drupal-2934995:2934995-bundle-permissions-link-template
into
9.3.x
Overview
0
Commits
4
Pipelines
0
Changes
25
Closed
Benji Fisher
requested to merge
issue/drupal-2934995:2934995-bundle-permissions-link-template
into
9.3.x
3 years ago
Overview
0
Commits
4
Pipelines
0
Changes
25
Expand
0
0
Merge request reports
Compare
9.3.x
9.3.x (base)
and
latest version
latest version
a8538d5a
4 commits,
3 years ago
25 files
+
786
−
56
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
25
Search (e.g. *.vue) (Ctrl+P)
core/lib/Drupal/Core/Entity/Enhancer/EntityBundleRouteEnhancer.php
0 → 100644
+
57
−
0
Options
<?php
namespace
Drupal\Core\Entity\Enhancer
;
use
Drupal\Core\Routing\EnhancerInterface
;
use
Drupal\Core\Routing\RouteObjectInterface
;
use
Drupal\Core\Entity\EntityTypeManagerInterface
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\Routing\Route
;
/**
* Sets the bundle parameter for routes with the _field_ui option.
*/
class
EntityBundleRouteEnhancer
implements
EnhancerInterface
{
/**
* The entity type manager service.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected
$entityTypeManager
;
/**
* Constructs a EntityBundleRouteEnhancer object.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager service.
*/
public
function
__construct
(
EntityTypeManagerInterface
$entity_type_manager
)
{
$this
->
entityTypeManager
=
$entity_type_manager
;
}
/**
* {@inheritdoc}
*/
public
function
enhance
(
array
$defaults
,
Request
$request
)
{
if
(
!
$this
->
applies
(
$defaults
[
RouteObjectInterface
::
ROUTE_OBJECT
]))
{
return
$defaults
;
}
if
((
$bundle
=
$this
->
entityTypeManager
->
getDefinition
(
$defaults
[
'entity_type_id'
])
->
getBundleEntityType
())
&&
isset
(
$defaults
[
$bundle
]))
{
// Field UI forms only need the actual name of the bundle they're dealing
// with, not an upcasted entity object, so provide a simple way for them
// to get it.
$defaults
[
'bundle'
]
=
$defaults
[
'_raw_variables'
]
->
get
(
$bundle
);
}
return
$defaults
;
}
/**
* {@inheritdoc}
*/
protected
function
applies
(
Route
$route
)
{
return
(
$route
->
hasOption
(
'_field_ui'
));
}
}
Loading