Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
A
admin_toolbar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
admin_toolbar
Commits
e6cc350d
Commit
e6cc350d
authored
Feb 05, 2016
by
matio89
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correction route of entities
parent
327832e5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
42 deletions
+19
-42
admin_toolbar_tools/admin_toolbar_tools.module
admin_toolbar_tools/admin_toolbar_tools.module
+19
-42
No files found.
admin_toolbar_tools/admin_toolbar_tools.module
View file @
e6cc350d
...
...
@@ -73,9 +73,25 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {
'route_name'
=>
'system.modules_uninstall'
,
'parent'
=>
'system.modules_list'
,
);
$content_entities
=
filterContentEntities
();
unset
(
$content_entities
[
'user'
]);
$content_entities
=
array
(
"block_content"
=>
array
(
"content_entity"
=>
"block_content"
,
"config_entity"
=>
"block_content_type"
),
"comment"
=>
array
(
"content_entity"
=>
"comment"
,
"config_entity"
=>
"comment_type"
),
"contact"
=>
array
(
"content_entity"
=>
"contact_message"
,
"config_entity"
=>
"contact_form"
),
"node"
=>
array
(
"content_entity"
=>
"node"
,
"config_entity"
=>
"node_type"
),
"taxonomy"
=>
array
(
"content_entity"
=>
"taxonomy_term"
,
"config_entity"
=>
"taxonomy_vocabulary"
),
);
// Add common links to entities.
// The common links for entities are :
// - Editing entity, Deleting entity,manage fields for entity
...
...
@@ -513,45 +529,6 @@ function filterFieldsByEntityName($entity_type_id, $bundle_search) {
return
$field_to_filter
;
}
/**
* Get config & content entity for every module.
* @return array
*/
function
getAllModulesWithEntities
()
{
$entities_to_filter
=
array
();
foreach
(
\
Drupal
::
entityTypeManager
()
->
getDefinitions
()
as
$entity_type_id
=>
$entity
)
{
//Get class
$class
=
$entity
->
getClass
();
//Get the module which the entity associated
$module
=
explode
(
'\\'
,
$class
)[
1
];
if
(
$entity
->
get
(
'field_ui_base_route'
)
!=
NULL
)
{
$entities_to_filter
[
$module
][
"content_entity"
]
=
$entity_type_id
;
}
else
{
$entities_to_filter
[
$module
][
"config_entity"
]
=
$entity_type_id
;
}
}
return
$entities_to_filter
;
}
/**
* Filter modules with only content entities
* @return array
*/
function
filterContentEntities
()
{
//All modules
$all_modules
=
getAllModulesWithEntities
();
//Initialise modules.
$filtred_modules
=
array
();
foreach
(
$all_modules
as
$module_name
=>
$entities
)
{
if
(
count
(
$entities
)
==
2
)
{
$filtred_modules
[
$module_name
]
=
$entities
;
}
}
return
$filtred_modules
;
}
/**
* Return installed themes.
* @return array
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment