Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
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
229
Merge Requests
229
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
drupal
Commits
f1713d57
Commit
f1713d57
authored
Aug 18, 2014
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2309187
by andypost | Crell: Fixed double-link-entry between Entity and Entity Type classes.
parent
4192e7d2
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
49 additions
and
146 deletions
+49
-146
core/lib/Drupal/Core/Entity/Entity.php
core/lib/Drupal/Core/Entity/Entity.php
+0
-5
core/lib/Drupal/Core/Entity/EntityManager.php
core/lib/Drupal/Core/Entity/EntityManager.php
+0
-14
core/lib/Drupal/Core/Entity/EntityManagerInterface.php
core/lib/Drupal/Core/Entity/EntityManagerInterface.php
+0
-16
core/lib/Drupal/Core/Entity/EntityType.php
core/lib/Drupal/Core/Entity/EntityType.php
+7
-0
core/modules/block_content/src/Entity/BlockContent.php
core/modules/block_content/src/Entity/BlockContent.php
+2
-2
core/modules/comment/src/Entity/Comment.php
core/modules/comment/src/Entity/Comment.php
+2
-2
core/modules/contact/src/Entity/Message.php
core/modules/contact/src/Entity/Message.php
+1
-3
core/modules/field_ui/src/FieldUI.php
core/modules/field_ui/src/FieldUI.php
+1
-1
core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php
...dules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php
+13
-14
core/modules/field_ui/src/Routing/RouteSubscriber.php
core/modules/field_ui/src/Routing/RouteSubscriber.php
+2
-2
core/modules/node/src/Entity/Node.php
core/modules/node/src/Entity/Node.php
+1
-1
core/modules/shortcut/src/Entity/Shortcut.php
core/modules/shortcut/src/Entity/Shortcut.php
+2
-2
core/modules/system/entity.api.php
core/modules/system/entity.api.php
+5
-1
core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php
...ystem/tests/modules/entity_test/src/Entity/EntityTest.php
+2
-2
core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php
...les/entity_test/src/Entity/EntityTestBaseFieldDisplay.php
+2
-2
core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php
...em/tests/modules/entity_test/src/Entity/EntityTestMul.php
+2
-2
core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php
...m/tests/modules/entity_test/src/Entity/EntityTestNoId.php
+1
-3
core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php
...sts/modules/entity_test/src/Entity/EntityTestStringId.php
+2
-2
core/modules/taxonomy/src/Entity/Term.php
core/modules/taxonomy/src/Entity/Term.php
+1
-1
core/modules/user/src/Entity/User.php
core/modules/user/src/Entity/User.php
+3
-3
core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
+0
-30
core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
+0
-38
No files found.
core/lib/Drupal/Core/Entity/Entity.php
View file @
f1713d57
...
@@ -254,11 +254,6 @@ protected function urlRouteParameters($rel) {
...
@@ -254,11 +254,6 @@ protected function urlRouteParameters($rel) {
// The entity ID is needed as a route parameter.
// The entity ID is needed as a route parameter.
$uri_route_parameters
[
$this
->
getEntityTypeId
()]
=
$this
->
id
();
$uri_route_parameters
[
$this
->
getEntityTypeId
()]
=
$this
->
id
();
// The 'admin-form' link requires the bundle as a route parameter if the
// entity type uses bundles.
if
(
$rel
==
'admin-form'
&&
$this
->
getEntityType
()
->
getBundleEntityType
()
!=
'bundle'
)
{
$uri_route_parameters
[
$this
->
getEntityType
()
->
getBundleEntityType
()]
=
$this
->
bundle
();
}
return
$uri_route_parameters
;
return
$uri_route_parameters
;
}
}
...
...
core/lib/Drupal/Core/Entity/EntityManager.php
View file @
f1713d57
...
@@ -329,20 +329,6 @@ public function getController($entity_type, $controller_type, $controller_class_
...
@@ -329,20 +329,6 @@ public function getController($entity_type, $controller_type, $controller_class_
return
$this
->
controllers
[
$controller_type
][
$entity_type
];
return
$this
->
controllers
[
$controller_type
][
$entity_type
];
}
}
/**
* {@inheritdoc}
*/
public
function
getAdminRouteInfo
(
$entity_type_id
,
$bundle
)
{
if
((
$entity_type
=
$this
->
getDefinition
(
$entity_type_id
,
FALSE
))
&&
$admin_form
=
$entity_type
->
getLinkTemplate
(
'admin-form'
))
{
return
array
(
'route_name'
=>
$admin_form
,
'route_parameters'
=>
array
(
$entity_type
->
getBundleEntityType
()
=>
$bundle
,
),
);
}
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
...
...
core/lib/Drupal/Core/Entity/EntityManagerInterface.php
View file @
f1713d57
...
@@ -116,22 +116,6 @@ public function getFieldMapByFieldType($field_type);
...
@@ -116,22 +116,6 @@ public function getFieldMapByFieldType($field_type);
*/
*/
public
function
getAccessControlHandler
(
$entity_type
);
public
function
getAccessControlHandler
(
$entity_type
);
/**
* Returns the route information for an entity type's bundle.
*
* @param string $entity_type_id
* The entity type.
* @param string $bundle
* The name of the bundle.
*
* @return array
* An associative array with the following keys:
* - route_name: The name of the route.
* - route_parameters: (optional) An associative array of parameter names
* and values.
*/
public
function
getAdminRouteInfo
(
$entity_type_id
,
$bundle
);
/**
/**
* Creates a new storage instance.
* Creates a new storage instance.
*
*
...
...
core/lib/Drupal/Core/Entity/EntityType.php
View file @
f1713d57
...
@@ -203,6 +203,13 @@ class EntityType implements EntityTypeInterface {
...
@@ -203,6 +203,13 @@ class EntityType implements EntityTypeInterface {
*/
*/
protected
$group_label
;
protected
$group_label
;
/**
* The route name used by field UI to attach its management pages.
*
* @var string
*/
protected
$field_ui_base_route
;
/**
/**
* Constructs a new EntityType.
* Constructs a new EntityType.
*
*
...
...
core/modules/block_content/src/Entity/BlockContent.php
View file @
f1713d57
...
@@ -41,7 +41,6 @@
...
@@ -41,7 +41,6 @@
* "canonical" = "entity.block_content.canonical",
* "canonical" = "entity.block_content.canonical",
* "delete-form" = "entity.block_content.delete_form",
* "delete-form" = "entity.block_content.delete_form",
* "edit-form" = "entity.block_content.canonical",
* "edit-form" = "entity.block_content.canonical",
* "admin-form" = "entity.block_content_type.edit_form"
* },
* },
* fieldable = TRUE,
* fieldable = TRUE,
* translatable = TRUE,
* translatable = TRUE,
...
@@ -52,7 +51,8 @@
...
@@ -52,7 +51,8 @@
* "label" = "info",
* "label" = "info",
* "uuid" = "uuid"
* "uuid" = "uuid"
* },
* },
* bundle_entity_type = "block_content_type"
* bundle_entity_type = "block_content_type",
* field_ui_base_route = "entity.block_content_type.edit_form",
* )
* )
*/
*/
class
BlockContent
extends
ContentEntityBase
implements
BlockContentInterface
{
class
BlockContent
extends
ContentEntityBase
implements
BlockContentInterface
{
...
...
core/modules/comment/src/Entity/Comment.php
View file @
f1713d57
...
@@ -49,9 +49,9 @@
...
@@ -49,9 +49,9 @@
* "canonical" = "entity.comment.canonical",
* "canonical" = "entity.comment.canonical",
* "delete-form" = "entity.comment.delete_form",
* "delete-form" = "entity.comment.delete_form",
* "edit-form" = "entity.comment.edit_form",
* "edit-form" = "entity.comment.edit_form",
* "admin-form" = "entity.comment_type.edit_form"
* },
* },
* bundle_entity_type = "comment_type"
* bundle_entity_type = "comment_type",
* field_ui_base_route = "entity.comment_type.edit_form",
* )
* )
*/
*/
class
Comment
extends
ContentEntityBase
implements
CommentInterface
{
class
Comment
extends
ContentEntityBase
implements
CommentInterface
{
...
...
core/modules/contact/src/Entity/Message.php
View file @
f1713d57
...
@@ -30,10 +30,8 @@
...
@@ -30,10 +30,8 @@
* "uuid" = "uuid"
* "uuid" = "uuid"
* },
* },
* bundle_entity_type = "contact_form",
* bundle_entity_type = "contact_form",
* field_ui_base_route = "entity.contact_form.edit_form",
* fieldable = TRUE,
* fieldable = TRUE,
* links = {
* "admin-form" = "entity.contact_form.edit_form"
* }
* )
* )
*/
*/
class
Message
extends
ContentEntityBase
implements
MessageInterface
{
class
Message
extends
ContentEntityBase
implements
MessageInterface
{
...
...
core/modules/field_ui/src/FieldUI.php
View file @
f1713d57
...
@@ -28,7 +28,7 @@ class FieldUI {
...
@@ -28,7 +28,7 @@ class FieldUI {
*/
*/
public
static
function
getOverviewRouteInfo
(
$entity_type_id
,
$bundle
)
{
public
static
function
getOverviewRouteInfo
(
$entity_type_id
,
$bundle
)
{
$entity_type
=
\
Drupal
::
entityManager
()
->
getDefinition
(
$entity_type_id
);
$entity_type
=
\
Drupal
::
entityManager
()
->
getDefinition
(
$entity_type_id
);
if
(
$entity_type
->
hasLinkTemplate
(
'admin-form
'
))
{
if
(
$entity_type
->
get
(
'field_ui_base_route
'
))
{
return
new
Url
(
"field_ui.overview_
$entity_type_id
"
,
array
(
return
new
Url
(
"field_ui.overview_
$entity_type_id
"
,
array
(
$entity_type
->
getBundleEntityType
()
=>
$bundle
,
$entity_type
->
getBundleEntityType
()
=>
$bundle
,
));
));
...
...
core/modules/field_ui/src/Plugin/Derivative/FieldUiLocalTask.php
View file @
f1713d57
...
@@ -69,7 +69,7 @@ public function getDerivativeDefinitions($base_plugin_definition) {
...
@@ -69,7 +69,7 @@ public function getDerivativeDefinitions($base_plugin_definition) {
$this
->
derivatives
=
array
();
$this
->
derivatives
=
array
();
foreach
(
$this
->
entityManager
->
getDefinitions
()
as
$entity_type_id
=>
$entity_type
)
{
foreach
(
$this
->
entityManager
->
getDefinitions
()
as
$entity_type_id
=>
$entity_type
)
{
if
(
$entity_type
->
isFieldable
()
&&
$entity_type
->
hasLinkTemplate
(
'admin-form
'
))
{
if
(
$entity_type
->
isFieldable
()
&&
$entity_type
->
get
(
'field_ui_base_route
'
))
{
$this
->
derivatives
[
"overview_
$entity_type_id
"
]
=
array
(
$this
->
derivatives
[
"overview_
$entity_type_id
"
]
=
array
(
'route_name'
=>
"field_ui.overview_
$entity_type_id
"
,
'route_name'
=>
"field_ui.overview_
$entity_type_id
"
,
'weight'
=>
1
,
'weight'
=>
1
,
...
@@ -171,21 +171,20 @@ public function getDerivativeDefinitions($base_plugin_definition) {
...
@@ -171,21 +171,20 @@ public function getDerivativeDefinitions($base_plugin_definition) {
* An array of local tasks plugin definitions, keyed by plugin ID.
* An array of local tasks plugin definitions, keyed by plugin ID.
*/
*/
public
function
alterLocalTasks
(
&
$local_tasks
)
{
public
function
alterLocalTasks
(
&
$local_tasks
)
{
foreach
(
$this
->
entityManager
->
getDefinitions
()
as
$entity_type
=>
$entity_info
)
{
foreach
(
$this
->
entityManager
->
getDefinitions
()
as
$entity_type_id
=>
$entity_type
)
{
if
(
$entity_info
->
isFieldable
()
&&
$entity_info
->
hasLinkTemplate
(
'admin-form'
))
{
if
(
$entity_type
->
isFieldable
()
&&
$route_name
=
$entity_type
->
get
(
'field_ui_base_route'
))
{
$admin_form
=
$entity_info
->
getLinkTemplate
(
'admin-form'
);
$local_tasks
[
"field_ui.fields:overview_
$entity_type_id
"
][
'base_route'
]
=
$route_name
;
$local_tasks
[
"field_ui.fields:overview_
$entity_type
"
][
'base_route'
]
=
$admin_form
;
$local_tasks
[
"field_ui.fields:form_display_overview_
$entity_type_id
"
][
'base_route'
]
=
$route_name
;
$local_tasks
[
"field_ui.fields:form_display_overview_
$entity_type
"
][
'base_route'
]
=
$admin_form
;
$local_tasks
[
"field_ui.fields:display_overview_
$entity_type_id
"
][
'base_route'
]
=
$route_name
;
$local_tasks
[
"field_ui.fields:display_overview_
$entity_type
"
][
'base_route'
]
=
$admin_form
;
$local_tasks
[
"field_ui.fields:field_form_display_default_
$entity_type_id
"
][
'base_route'
]
=
$route_name
;
$local_tasks
[
"field_ui.fields:field_form_display_default_
$entity_type
"
][
'base_route'
]
=
$admin_form
;
$local_tasks
[
"field_ui.fields:field_display_default_
$entity_type_id
"
][
'base_route'
]
=
$route_name
;
$local_tasks
[
"field_ui.fields:field_display_default_
$entity_type
"
][
'base_route'
]
=
$admin_form
;
foreach
(
$this
->
entityManager
->
getFormModes
(
$entity_type_id
)
as
$form_mode
=>
$form_mode_info
)
{
foreach
(
$this
->
entityManager
->
getFormModes
(
$entity_type
)
as
$form_mode
=>
$form_mode_info
)
{
$local_tasks
[
'field_ui.fields:field_form_display_'
.
$form_mode
.
'_'
.
$entity_type_id
][
'base_route'
]
=
$route_name
;
$local_tasks
[
'field_ui.fields:field_form_display_'
.
$form_mode
.
'_'
.
$entity_type
][
'base_route'
]
=
$admin_form
;
}
}
foreach
(
$this
->
entityManager
->
getViewModes
(
$entity_type
)
as
$view_mode
=>
$form_mode_info
)
{
foreach
(
$this
->
entityManager
->
getViewModes
(
$entity_type
_id
)
as
$view_mode
=>
$form_mode_info
)
{
$local_tasks
[
'field_ui.fields:field_display_'
.
$view_mode
.
'_'
.
$entity_type
][
'base_route'
]
=
$admin_form
;
$local_tasks
[
'field_ui.fields:field_display_'
.
$view_mode
.
'_'
.
$entity_type
_id
][
'base_route'
]
=
$route_name
;
}
}
}
}
}
}
...
...
core/modules/field_ui/src/Routing/RouteSubscriber.php
View file @
f1713d57
...
@@ -41,9 +41,9 @@ public function __construct(EntityManagerInterface $manager) {
...
@@ -41,9 +41,9 @@ public function __construct(EntityManagerInterface $manager) {
protected
function
alterRoutes
(
RouteCollection
$collection
)
{
protected
function
alterRoutes
(
RouteCollection
$collection
)
{
foreach
(
$this
->
manager
->
getDefinitions
()
as
$entity_type_id
=>
$entity_type
)
{
foreach
(
$this
->
manager
->
getDefinitions
()
as
$entity_type_id
=>
$entity_type
)
{
$defaults
=
array
();
$defaults
=
array
();
if
(
$entity_type
->
isFieldable
()
&&
$
entity_type
->
hasLinkTemplate
(
'admin-form
'
))
{
if
(
$entity_type
->
isFieldable
()
&&
$
route_name
=
$entity_type
->
get
(
'field_ui_base_route
'
))
{
// Try to get the route from the current collection.
// Try to get the route from the current collection.
if
(
!
$entity_route
=
$collection
->
get
(
$
entity_type
->
getLinkTemplate
(
'admin-form'
)
))
{
if
(
!
$entity_route
=
$collection
->
get
(
$
route_name
))
{
continue
;
continue
;
}
}
$path
=
$entity_route
->
getPath
();
$path
=
$entity_route
->
getPath
();
...
...
core/modules/node/src/Entity/Node.php
View file @
f1713d57
...
@@ -50,13 +50,13 @@
...
@@ -50,13 +50,13 @@
* "uuid" = "uuid"
* "uuid" = "uuid"
* },
* },
* bundle_entity_type = "node_type",
* bundle_entity_type = "node_type",
* field_ui_base_route = "entity.node_type.edit_form",
* permission_granularity = "bundle",
* permission_granularity = "bundle",
* links = {
* links = {
* "canonical" = "entity.node.canonical",
* "canonical" = "entity.node.canonical",
* "delete-form" = "entity.node.delete_form",
* "delete-form" = "entity.node.delete_form",
* "edit-form" = "entity.node.edit_form",
* "edit-form" = "entity.node.edit_form",
* "version-history" = "entity.node.version_history",
* "version-history" = "entity.node.version_history",
* "admin-form" = "entity.node_type.edit_form"
* }
* }
* )
* )
*/
*/
...
...
core/modules/shortcut/src/Entity/Shortcut.php
View file @
f1713d57
...
@@ -44,9 +44,9 @@
...
@@ -44,9 +44,9 @@
* "canonical" = "entity.shortcut.canonical",
* "canonical" = "entity.shortcut.canonical",
* "delete-form" = "entity.shortcut.delete_form",
* "delete-form" = "entity.shortcut.delete_form",
* "edit-form" = "entity.shortcut.canonical",
* "edit-form" = "entity.shortcut.canonical",
* "admin-form" = "entity.shortcut.canonical"
* },
* },
* bundle_entity_type = "shortcut_set"
* bundle_entity_type = "shortcut_set",
* field_ui_base_route = "entity.shortcut.canonical",
* )
* )
*/
*/
class
Shortcut
extends
ContentEntityBase
implements
ShortcutInterface
{
class
Shortcut
extends
ContentEntityBase
implements
ShortcutInterface
{
...
...
core/modules/system/entity.api.php
View file @
f1713d57
...
@@ -332,8 +332,12 @@
...
@@ -332,8 +332,12 @@
* own pages) or edit the entity.
* own pages) or edit the entity.
* - delete-form: Confirmation form to delete the entity.
* - delete-form: Confirmation form to delete the entity.
* - edit-form: Editing form.
* - edit-form: Editing form.
* - admin-form: Form for editing bundle or entity type settings.
* - Other link types specific to your entity type can also be defined.
* - Other link types specific to your entity type can also be defined.
* - If your content entity is fieldable, provide 'field_ui_base_route'
* annotation, giving the name of the route that the Manage Fields, Manage
* Display, and Manage Form Display pages from the Field UI module will be
* attached to. This is usually the bundle settings edit page, or an entity
* type settings page if there are no bundles.
* - If your content entity has bundles, you will also need to define a second
* - If your content entity has bundles, you will also need to define a second
* plugin to handle the bundles. This plugin is itself a configuration entity
* plugin to handle the bundles. This plugin is itself a configuration entity
* type, so follow the steps here to define it. The machine name ('id'
* type, so follow the steps here to define it. The machine name ('id'
...
...
core/modules/system/tests/modules/entity_test/src/Entity/EntityTest.php
View file @
f1713d57
...
@@ -44,8 +44,8 @@
...
@@ -44,8 +44,8 @@
* "canonical" = "entity_test.render",
* "canonical" = "entity_test.render",
* "edit-form" = "entity_test.edit_entity_test",
* "edit-form" = "entity_test.edit_entity_test",
* "delete-form" = "entity_test.delete_entity_test",
* "delete-form" = "entity_test.delete_entity_test",
*
"admin-form" = "entity_test.admin_entity_test"
*
},
*
}
*
field_ui_base_route = "entity_test.admin_entity_test",
* )
* )
*/
*/
class
EntityTest
extends
ContentEntityBase
implements
EntityOwnerInterface
{
class
EntityTest
extends
ContentEntityBase
implements
EntityOwnerInterface
{
...
...
core/modules/system/tests/modules/entity_test/src/Entity/EntityTestBaseFieldDisplay.php
View file @
f1713d57
...
@@ -32,8 +32,8 @@
...
@@ -32,8 +32,8 @@
* },
* },
* links = {
* links = {
* "edit-form" = "entity_test.edit_entity_test",
* "edit-form" = "entity_test.edit_entity_test",
*
"admin-form" = "entity_test.admin_entity_test"
*
},
*
}
*
field_ui_base_route = "entity_test.admin_entity_test",
* )
* )
*/
*/
class
EntityTestBaseFieldDisplay
extends
EntityTest
{
class
EntityTestBaseFieldDisplay
extends
EntityTest
{
...
...
core/modules/system/tests/modules/entity_test/src/Entity/EntityTestMul.php
View file @
f1713d57
...
@@ -40,8 +40,8 @@
...
@@ -40,8 +40,8 @@
* "canonical" = "entity_test.edit_entity_test_mul",
* "canonical" = "entity_test.edit_entity_test_mul",
* "edit-form" = "entity_test.edit_entity_test_mul",
* "edit-form" = "entity_test.edit_entity_test_mul",
* "delete-form" = "entity_test.delete_entity_test_mul",
* "delete-form" = "entity_test.delete_entity_test_mul",
*
"admin-form" = "entity_test.admin_entity_test_mul"
*
},
*
}
*
field_ui_base_route = "entity_test.admin_entity_test_mul",
* )
* )
*/
*/
class
EntityTestMul
extends
EntityTest
{
class
EntityTestMul
extends
EntityTest
{
...
...
core/modules/system/tests/modules/entity_test/src/Entity/EntityTestNoId.php
View file @
f1713d57
...
@@ -20,9 +20,7 @@
...
@@ -20,9 +20,7 @@
* entity_keys = {
* entity_keys = {
* "bundle" = "type",
* "bundle" = "type",
* },
* },
* links = {
* field_ui_base_route = "entity_test.admin_entity_test_no_id",
* "admin-form" = "entity_test.admin_entity_test_no_id"
* }
* )
* )
*/
*/
class
EntityTestNoId
extends
EntityTest
{
class
EntityTestNoId
extends
EntityTest
{
...
...
core/modules/system/tests/modules/entity_test/src/Entity/EntityTestStringId.php
View file @
f1713d57
...
@@ -33,8 +33,8 @@
...
@@ -33,8 +33,8 @@
* links = {
* links = {
* "canonical" = "entity_test.render",
* "canonical" = "entity_test.render",
* "edit-form" = "entity_test.edit_entity_test_string_id",
* "edit-form" = "entity_test.edit_entity_test_string_id",
*
"admin-form" = "entity_test.admin_entity_test_string_id"
*
},
*
}
*
field_ui_base_route = "entity_test.admin_entity_test_string_id",
* )
* )
*/
*/
class
EntityTestStringId
extends
EntityTest
{
class
EntityTestStringId
extends
EntityTest
{
...
...
core/modules/taxonomy/src/Entity/Term.php
View file @
f1713d57
...
@@ -43,11 +43,11 @@
...
@@ -43,11 +43,11 @@
* "uuid" = "uuid"
* "uuid" = "uuid"
* },
* },
* bundle_entity_type = "taxonomy_vocabulary",
* bundle_entity_type = "taxonomy_vocabulary",
* field_ui_base_route = "taxonomy.overview_terms",
* links = {
* links = {
* "canonical" = "taxonomy.term_page",
* "canonical" = "taxonomy.term_page",
* "delete-form" = "taxonomy.term_delete",
* "delete-form" = "taxonomy.term_delete",
* "edit-form" = "taxonomy.term_edit",
* "edit-form" = "taxonomy.term_edit",
* "admin-form" = "taxonomy.overview_terms"
* },
* },
* permission_granularity = "bundle"
* permission_granularity = "bundle"
* )
* )
...
...
core/modules/user/src/Entity/User.php
View file @
f1713d57
...
@@ -49,9 +49,9 @@
...
@@ -49,9 +49,9 @@
* links = {
* links = {
* "canonical" = "entity.user.canonical",
* "canonical" = "entity.user.canonical",
* "edit-form" = "entity.user.edit_form",
* "edit-form" = "entity.user.edit_form",
* "
admin-form" = "entity.user.admin
_form",
* "
cancel-form" = "entity.user.cancel
_form",
*
"cancel-form" = "entity.user.cancel_form"
*
},
*
}
*
field_ui_base_route = "entity.user.admin_form",
* )
* )
*/
*/
class
User
extends
ContentEntityBase
implements
UserInterface
{
class
User
extends
ContentEntityBase
implements
UserInterface
{
...
...
core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php
View file @
f1713d57
...
@@ -436,36 +436,6 @@ public function testGetControllerMissingController() {
...
@@ -436,36 +436,6 @@ public function testGetControllerMissingController() {
$this
->
entityManager
->
getController
(
'test_entity_type'
,
'storage'
);
$this
->
entityManager
->
getController
(
'test_entity_type'
,
'storage'
);
}
}
/**
* Tests the getAdminRouteInfo() method.
*
* @covers ::getAdminRouteInfo()
*/
public
function
testGetAdminRouteInfo
()
{
$apple
=
$this
->
getMock
(
'Drupal\Core\Entity\EntityTypeInterface'
);
$banana
=
$this
->
getMock
(
'Drupal\Core\Entity\EntityTypeInterface'
);
$banana
->
expects
(
$this
->
once
())
->
method
(
'getBundleEntityType'
)
->
will
(
$this
->
returnValue
(
'bundle'
));
$banana
->
expects
(
$this
->
once
())
->
method
(
'getLinkTemplate'
)
->
with
(
'admin-form'
)
->
will
(
$this
->
returnValue
(
'entity.view'
));
$this
->
setUpEntityManager
(
array
(
'apple'
=>
$apple
,
'banana'
=>
$banana
,
));
$expected
=
array
(
'route_name'
=>
'entity.view'
,
'route_parameters'
=>
array
(
'bundle'
=>
'chiquita'
,
),
);
$this
->
assertSame
(
$expected
,
$this
->
entityManager
->
getAdminRouteInfo
(
'banana'
,
'chiquita'
));
$this
->
assertNull
(
$this
->
entityManager
->
getAdminRouteInfo
(
'apple'
,
'delicious'
));
}
/**
/**
* Tests the getBaseFieldDefinitions() method.
* Tests the getBaseFieldDefinitions() method.
*
*
...
...
core/tests/Drupal/Tests/Core/Entity/EntityUrlTest.php
View file @
f1713d57
...
@@ -198,44 +198,6 @@ public function testUrl() {
...
@@ -198,44 +198,6 @@ public function testUrl() {
$this
->
assertSame
(
'http://drupal/entity/test_entity_type/test_entity_id'
,
$valid_entity
->
url
(
'canonical'
,
array
(
'absolute'
=>
TRUE
)));
$this
->
assertSame
(
'http://drupal/entity/test_entity_type/test_entity_id'
,
$valid_entity
->
url
(
'canonical'
,
array
(
'absolute'
=>
TRUE
)));
}
}
/**
* Tests the url() method for "admin-form".
*
* @covers ::urlRouteParameters()
*/
public
function
testUrlForAdminForm
()
{
$entity_type
=
$this
->
getMock
(
'Drupal\Core\Entity\EntityTypeInterface'
);
$entity_type
->
expects
(
$this
->
exactly
(
2
))
->
method
(
'getLinkTemplates'
)
->
will
(
$this
->
returnValue
(
array
(
'admin-form'
=>
'test_entity_type.admin_form'
,
)));
$entity_type
->
expects
(
$this
->
exactly
(
2
))
->
method
(
'getBundleEntityType'
)
->
will
(
$this
->
returnValue
(
'test_entity_type_bundle'
));
$this
->
entityManager
->
expects
(
$this
->
exactly
(
4
))
->
method
(
'getDefinition'
)
->
with
(
'test_entity_type'
)
->
will
(
$this
->
returnValue
(
$entity_type
));
$this
->
urlGenerator
->
expects
(
$this
->
once
())
->
method
(
'generateFromRoute'
)
->
with
(
'test_entity_type.admin_form'
,
array
(
'test_entity_type_bundle'
=>
'test_entity_bundle'
,
'test_entity_type'
=>
'test_entity_id'
,
))
->
will
(
$this
->
returnValue
(
'entity/test_entity_type/test_entity_bundle/test_entity_id'
));
$entity
=
$this
->
getMockForAbstractClass
(
'Drupal\Core\Entity\Entity'
,
array
(
array
(
'id'
=>
'test_entity_id'
),
'test_entity_type'
),
''
,
TRUE
,
TRUE
,
TRUE
,
array
(
'bundle'
));
$entity
->
expects
(
$this
->
any
())
->
method
(
'bundle'
)
->
will
(
$this
->
returnValue
(
'test_entity_bundle'
));
$this
->
assertSame
(
'entity/test_entity_type/test_entity_bundle/test_entity_id'
,
$entity
->
url
(
'admin-form'
));
}
/**
/**
* Tests the getPathByAlias() method.
* Tests the getPathByAlias() method.
*
*
...
...
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