Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
auto_entitylabel
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
auto_entitylabel
Commits
a40d5ad2
Commit
a40d5ad2
authored
7 years ago
by
Merlin Axel Rutz
Committed by
Colan Schwartz
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2856152
by axel.rutz: Auto Label tab not displayed for Media-Entity Bundles
parent
c057e50d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
auto_entitylabel.module
+3
-16
3 additions, 16 deletions
auto_entitylabel.module
with
3 additions
and
16 deletions
auto_entitylabel.module
+
3
−
16
View file @
a40d5ad2
...
...
@@ -35,27 +35,14 @@ function auto_entitylabel_help($route_name, RouteMatchInterface $route_match) {
* Implements hook_entity_type_alter().
*
* Adds the Auto Label tab to the entity configuration page.
*
* @param \Drupal\Core\Entity\EntityTypeInterface[] $entity_types
*/
function
auto_entitylabel_entity_type_alter
(
array
&
$entity_types
)
{
$module_handler
=
\Drupal
::
moduleHandler
();
// @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[].
foreach
(
$entity_types
as
$entity_type
)
{
// Support core entity types only. Contrib and custom entity types should
// use a hook or service (@todo https://www.drupal.org/node/2829571).
$core_entity
=
FALSE
;
$module_name
=
$entity_type
->
getProvider
();
if
(
$module_name
!=
'core'
)
{
// Identify core entity types that are provided by modules.
$module
=
$module_handler
->
getModule
(
$module_name
);
if
(
preg_match
(
'/^core/'
,
$module
->
getPath
()))
{
$core_entity
=
TRUE
;
}
}
else
{
// Some core entity types are not provided by a module.
$core_entity
=
TRUE
;
}
if
(
$core_entity
&&
$entity_type
instanceof
ConfigEntityType
&&
$entity_type
->
hasLinkTemplate
(
'edit-form'
))
{
if
(
$entity_type
->
getBundleOf
()
&&
$entity_type
->
hasLinkTemplate
(
'edit-form'
))
{
$entity_type
->
setLinkTemplate
(
'auto-label'
,
$entity_type
->
getLinkTemplate
(
'edit-form'
)
.
"/auto-label"
);
}
}
...
...
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