diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index c8b9eda..aa1cb34 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -188,4 +188,11 @@ public function preSave(EntityStorageControllerInterface $storage_controller) { } } + /** + * {@inheritdoc} + */ + public function uri() { + return parent::uri('edit-form'); + } + } diff --git a/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php index 68404ba..466c840 100644 --- a/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -149,36 +149,109 @@ public function label($langcode = NULL) { } /** - * Implements \Drupal\Core\Entity\EntityInterface::uri(). + * Returns the URI elements of the entity. + * + * URI templates might be set in the links array in an annotation, for + * example: + * @code + * links = { + * "canonical" = "/node/{node}", + * "edit-form" = "/node/{node}/edit", + * "version-history" = "/node/{node}/revisions" + * } + * @endcode + * or specified in a callback function set like: + * @code + * uri_callback = "contact_category_uri", + * @endcode + * If looking for the canonical URI, and it was not set in the links array + * or in a uri_callback function, the path is set using the default template: + * entity/entityType/id. + * + * @param string $rel + * The link relationship type, for example: canonical or edit-form. + * + * @return + * An array containing the 'path' and 'options' keys used to build the URI + * of the entity, and matching the signature of url(). */ - public function uri() { - $bundle = $this->bundle(); - // A bundle-specific callback takes precedence over the generic one for the - // entity type. + public function uri($rel = 'canonical') { $entity_info = $this->entityInfo(); - $bundles = entity_get_bundles($this->entityType); - if (isset($bundles[$bundle]['uri_callback'])) { - $uri_callback = $bundles[$bundle]['uri_callback']; - } - elseif (isset($entity_info['uri_callback'])) { - $uri_callback = $entity_info['uri_callback']; + + // The links array might contain URI templates set in annotations. + $link_templates = isset($entity_info['links']) ? $entity_info['links'] : array(); + + if (isset($link_templates[$rel])) { + // If there is a template for the given relationship type, do the + // placeholder replacement and use that as the path. + $template = $link_templates[$rel]; + $replacements = $this->uriPlaceholderReplacements(); + $uri['path'] = str_replace(array_keys($replacements), array_values($replacements), $template); + + // @todo Remove this once http://drupal.org/node/1888424 is in and we can + // move the BC handling of / vs. no-/ to the generator. + $uri['path'] = trim($uri['path'], '/'); + + // Pass the entity data to url() so that alter functions do not need to + // look up this entity again. + $uri['options']['entity_type'] = $this->entityType; + $uri['options']['entity'] = $this; + return $uri; } - // Invoke the callback to get the URI. If there is no callback, use the - // default URI format. - if (isset($uri_callback) && function_exists($uri_callback)) { - $uri = $uri_callback($this); + // Only use these defaults for a canonical link (that is, a link to self). + // Other relationship types are not supported by this logic. + if ($rel == 'canonical') { + $bundle = $this->bundle(); + // A bundle-specific callback takes precedence over the generic one for + // the entity type. + $bundles = entity_get_bundles($this->entityType); + if (isset($bundles[$bundle]['uri_callback'])) { + $uri_callback = $bundles[$bundle]['uri_callback']; + } + elseif (isset($entity_info['uri_callback'])) { + $uri_callback = $entity_info['uri_callback']; + } + + // Invoke the callback to get the URI. If there is no callback, use the + // default URI format. + if (isset($uri_callback) && function_exists($uri_callback)) { + $uri = $uri_callback($this); + } + else { + $uri = array( + 'path' => 'entity/' . $this->entityType . '/' . $this->id(), + ); + } + // Pass the entity data to url() so that alter functions do not need to + // look up this entity again. + $uri['options']['entity_type'] = $this->entityType; + $uri['options']['entity'] = $this; + return $uri; } - else { - $uri = array( - 'path' => 'entity/' . $this->entityType . '/' . $this->id(), + } + + /** + * Returns an array of placeholders for this entity. + * + * Individual entity classes may override this method to add additional + * placeholders if desired. If so, they should be sure to replicate the + * property caching logic. + * + * @return array + * An array of URI placeholders. + */ + protected function uriPlaceholderReplacements() { + if (empty($this->uriPlaceholderReplacements)) { + $this->uriPlaceholderReplacements = array( + '{entityType}' => $this->entityType(), + '{bundle}' => $this->bundle(), + '{id}' => $this->id(), + '{uuid}' => $this->uuid(), + '{' . $this->entityType() . '}' => $this->id(), ); } - // Pass the entity data to url() so that alter functions do not need to - // look up this entity again. - $uri['options']['entity_type'] = $this->entityType; - $uri['options']['entity'] = $this; - return $uri; + return $this->uriPlaceholderReplacements; } /** diff --git a/core/lib/Drupal/Core/Entity/EntityNG.php b/core/lib/Drupal/Core/Entity/EntityNG.php index d0b6b4c..4e52423 100644 --- a/core/lib/Drupal/Core/Entity/EntityNG.php +++ b/core/lib/Drupal/Core/Entity/EntityNG.php @@ -217,61 +217,6 @@ public function uuid() { } /** - * {@inheritdoc} - */ - public function uri($rel = 'canonical') { - $entity_info = $this->entityInfo(); - - $link_templates = isset($entity_info['links']) ? $entity_info['links'] : array(); - - if (isset($link_templates[$rel])) { - $template = $link_templates[$rel]; - $replacements = $this->uriPlaceholderReplacements(); - $uri['path'] = str_replace(array_keys($replacements), array_values($replacements), $template); - - // @todo Remove this once http://drupal.org/node/1888424 is in and we can - // move the BC handling of / vs. no-/ to the generator. - $uri['path'] = trim($uri['path'], '/'); - - // Pass the entity data to url() so that alter functions do not need to - // look up this entity again. - $uri['options']['entity_type'] = $this->entityType; - $uri['options']['entity'] = $this; - return $uri; - } - - // For a canonical link (that is, a link to self), look up the stack for - // default logic. Other relationship types are not supported by parent - // classes. - if ($rel == 'canonical') { - return parent::uri(); - } - } - - /** - * Returns an array of placeholders for this entity. - * - * Individual entity classes may override this method to add additional - * placeholders if desired. If so, they should be sure to replicate the - * property caching logic. - * - * @return array - * An array of URI placeholders. - */ - protected function uriPlaceholderReplacements() { - if (empty($this->uriPlaceholderReplacements)) { - $this->uriPlaceholderReplacements = array( - '{entityType}' => $this->entityType(), - '{bundle}' => $this->bundle(), - '{id}' => $this->id(), - '{uuid}' => $this->uuid(), - '{' . $this->entityType() . '}' => $this->id(), - ); - } - return $this->uriPlaceholderReplacements; - } - - /** * Implements \Drupal\Core\TypedData\ComplexDataInterface::get(). */ public function get($property_name) { diff --git a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php index cb1a57e..b522464 100644 --- a/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php +++ b/core/modules/block/custom_block/lib/Drupal/custom_block/Entity/CustomBlockType.php @@ -37,6 +37,9 @@ * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/structure/block/custom-blocks/manage/{custom_block_type}" * } * ) */ @@ -78,19 +81,6 @@ class CustomBlockType extends ConfigEntityBase implements CustomBlockTypeInterfa public $description; /** - * Overrides \Drupal\Core\Entity\Entity::uri(). - */ - public function uri() { - return array( - 'path' => 'admin/structure/block/custom-blocks/manage/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ) - ); - } - - /** * {@inheritdoc} */ public function postSave(EntityStorageControllerInterface $storage_controller, $update = TRUE) { diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php index faaccde..aeac9c3 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php @@ -62,7 +62,7 @@ function testCRUD() { $this->assertIdentical($empty->isNewRevision(), FALSE); $this->assertIdentical($empty->entityType(), 'config_test'); $uri = $empty->uri(); - $this->assertIdentical($uri['path'], 'admin/structure/config_test/manage/'); + $this->assertIdentical($uri['path'], 'admin/structure/config_test/manage'); $this->assertIdentical($empty->isDefaultRevision(), TRUE); // Verify that an empty entity cannot be saved. diff --git a/core/modules/config/tests/config_test/config_test.module b/core/modules/config/tests/config_test/config_test.module index a985921..86fe4a9 100644 --- a/core/modules/config/tests/config_test/config_test.module +++ b/core/modules/config/tests/config_test/config_test.module @@ -11,18 +11,6 @@ require_once dirname(__FILE__) . '/config_test.hooks.inc'; /** - * Entity URI callback. - * - * @param Drupal\config_test\Entity\ConfigTest $config_test - * A ConfigTest entity. - */ -function config_test_uri(ConfigTest $config_test) { - return array( - 'path' => 'admin/structure/config_test/manage/' . $config_test->id(), - ); -} - -/** * Implements hook_menu(). */ function config_test_menu() { diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php index e909f4d..6c55057 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigQueryTest.php @@ -24,12 +24,14 @@ * "default" = "Drupal\config_test\ConfigTestFormController" * } * }, - * uri_callback = "config_test_uri", * config_prefix = "config_query_test.dynamic", * entity_keys = { * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/structure/config_test/manage/{config_query_test}" * } * ) * diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php index c355e25..c4d330e 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/Entity/ConfigTest.php @@ -28,13 +28,15 @@ * }, * "access" = "Drupal\config_test\ConfigTestAccessController" * }, - * uri_callback = "config_test_uri", * config_prefix = "config_test.dynamic", * entity_keys = { * "id" = "id", * "label" = "label", * "uuid" = "uuid", * "status" = "status" + * }, + * links = { + * "edit-form" = "admin/structure/config_test/manage/{config_test}" * } * ) */ diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index 2b1d8bf..298ca7f 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -241,21 +241,6 @@ function contact_category_load($id) { } /** - * Entity URI callback. - * - * @param Drupal\contact\Entity\Category $category - * A contact category entity. - * - * @return array - * An array with 'path' as the key and the path to the category as the value. - */ -function contact_category_uri(Category $category) { - return array( - 'path' => 'admin/structure/contact/manage/' . $category->id(), - ); -} - -/** * Implements hook_mail(). */ function contact_mail($key, &$message, $params) { diff --git a/core/modules/contact/lib/Drupal/contact/Entity/Category.php b/core/modules/contact/lib/Drupal/contact/Entity/Category.php index 7f633fc..646dcad 100644 --- a/core/modules/contact/lib/Drupal/contact/Entity/Category.php +++ b/core/modules/contact/lib/Drupal/contact/Entity/Category.php @@ -30,13 +30,15 @@ * "delete" = "Drupal\contact\Form\CategoryDeleteForm" * } * }, - * uri_callback = "contact_category_uri", * config_prefix = "contact.category", * bundle_of = "contact_message", * entity_keys = { * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/structure/contact/manage/{contact_category}" * } * ) */ diff --git a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormMode.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormMode.php index f2aa4bd..ac13757 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormMode.php +++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormMode.php @@ -48,22 +48,12 @@ * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/structure/display-modes/form/manage/{form_mode}" * } * ) */ class EntityFormMode extends EntityDisplayModeBase implements EntityFormModeInterface { - /** - * {@inheritdoc} - */ - public function uri() { - return array( - 'path' => 'admin/structure/display-modes/form/manage/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - } diff --git a/core/modules/entity/lib/Drupal/entity/Entity/EntityViewMode.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityViewMode.php index e7f2a10..c46ef60 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity/EntityViewMode.php +++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityViewMode.php @@ -49,22 +49,12 @@ * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/structure/display-modes/view/manage/{view_mode}" * } * ) */ class EntityViewMode extends EntityDisplayModeBase implements EntityViewModeInterface { - /** - * {@inheritdoc} - */ - public function uri() { - return array( - 'path' => 'admin/structure/display-modes/view/manage/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - } diff --git a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php index 71ca04d..a01e94a 100644 --- a/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php +++ b/core/modules/filter/lib/Drupal/filter/Entity/FilterFormat.php @@ -38,6 +38,9 @@ * "uuid" = "uuid", * "weight" = "weight", * "status" = "status" + * }, + * links = { + * "edit-form" = "admin/config/content/formats/manage/{filter_format}" * } * ) */ @@ -191,19 +194,6 @@ public function disable() { /** * {@inheritdoc} */ - public function uri() { - return array( - 'path' => 'admin/config/content/formats/manage/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - - /** - * {@inheritdoc} - */ public function preSave(EntityStorageControllerInterface $storage_controller) { $this->name = trim($this->label()); diff --git a/core/modules/image/image.module b/core/modules/image/image.module index fa03dcd..c620ed4 100644 --- a/core/modules/image/image.module +++ b/core/modules/image/image.module @@ -78,15 +78,6 @@ function image_help($path, $arg) { } /** - * Entity URI callback for image style. - */ -function image_style_entity_uri(ImageStyle $style) { - return array( - 'path' => 'admin/config/media/image-styles/manage/' . $style->id(), - ); -} - -/** * Implements hook_menu(). */ function image_menu() { diff --git a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php index 4d12539..b340bcd 100644 --- a/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php +++ b/core/modules/image/lib/Drupal/image/Entity/ImageStyle.php @@ -35,12 +35,14 @@ * "list" = "Drupal\image\ImageStyleListController", * "access" = "Drupal\image\ImageStyleAccessController" * }, - * uri_callback = "image_style_entity_uri", * config_prefix = "image.style", * entity_keys = { * "id" = "name", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/config/media/image-styles/manage/{image_style}" * } * ) */ diff --git a/core/modules/language/lib/Drupal/language/Entity/Language.php b/core/modules/language/lib/Drupal/language/Entity/Language.php index 23f65db..c689361 100644 --- a/core/modules/language/lib/Drupal/language/Entity/Language.php +++ b/core/modules/language/lib/Drupal/language/Entity/Language.php @@ -35,6 +35,9 @@ * "label" = "label", * "weight" = "weight", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/config/regional/language/edit/{language_entity}" * } * ) */ @@ -95,17 +98,4 @@ public function preSave(EntityStorageControllerInterface $storage_controller) { $this->langcode = 'en'; } - /** - * {@inheritdoc} - */ - public function uri() { - return array( - 'path' => 'admin/config/regional/language/edit/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - } diff --git a/core/modules/node/lib/Drupal/node/Entity/NodeType.php b/core/modules/node/lib/Drupal/node/Entity/NodeType.php index cc6021c..caac324 100644 --- a/core/modules/node/lib/Drupal/node/Entity/NodeType.php +++ b/core/modules/node/lib/Drupal/node/Entity/NodeType.php @@ -36,6 +36,9 @@ * "id" = "type", * "label" = "name", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/structure/types/manage/{node_type}" * } * ) */ @@ -139,19 +142,6 @@ public function id() { /** * {@inheritdoc} */ - public function uri() { - return array( - 'path' => 'admin/structure/types/manage/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - - /** - * {@inheritdoc} - */ public function getModuleSettings($module) { if (isset($this->settings[$module]) && is_array($this->settings[$module])) { return $this->settings[$module]; diff --git a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php index fb266fa..b42fbee 100644 --- a/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php +++ b/core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php @@ -36,6 +36,9 @@ * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/config/media/picturemapping/{picture_mapping}" * } * ) */ @@ -162,17 +165,4 @@ public function hasMappings() { } return $mapping_found; } - - /** - * {@inheritdoc} - */ - public function uri() { - return array( - 'path' => 'admin/config/media/picturemapping/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } } diff --git a/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php b/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php index 6ff6936..2994897 100644 --- a/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php +++ b/core/modules/shortcut/lib/Drupal/shortcut/Entity/ShortcutSet.php @@ -37,6 +37,9 @@ * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/config/user-interface/shortcut/manage/{shortcut_set}" * } * ) */ @@ -71,19 +74,6 @@ class ShortcutSet extends ConfigEntityBase implements ShortcutSetInterface { public $links = array(); /** - * Overrides \Drupal\Core\Entity\Entity::uri(). - */ - public function uri() { - return array( - 'path' => 'admin/config/user-interface/shortcut/manage/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - - /** * {@inheritdoc} */ public function postCreate(EntityStorageControllerInterface $storage_controller) { diff --git a/core/modules/system/lib/Drupal/system/Entity/Action.php b/core/modules/system/lib/Drupal/system/Entity/Action.php index c390a76..ca9623d 100644 --- a/core/modules/system/lib/Drupal/system/Entity/Action.php +++ b/core/modules/system/lib/Drupal/system/Entity/Action.php @@ -31,6 +31,9 @@ * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/config/system/actions/configure/{action}" * } * ) */ @@ -140,19 +143,6 @@ public function getType() { /** * {@inheritdoc} */ - public function uri() { - return array( - 'path' => 'admin/config/system/actions/configure/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - - /** - * {@inheritdoc} - */ public static function sort($a, $b) { $a_type = $a->getType(); $b_type = $b->getType(); diff --git a/core/modules/system/lib/Drupal/system/Entity/DateFormat.php b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php index 7762b88..6034503 100644 --- a/core/modules/system/lib/Drupal/system/Entity/DateFormat.php +++ b/core/modules/system/lib/Drupal/system/Entity/DateFormat.php @@ -36,6 +36,9 @@ * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/config/regional/date-time/formats/manage/{date_format}" * } * ) */ @@ -84,19 +87,6 @@ class DateFormat extends ConfigEntityBase implements DateFormatInterface { /** * {@inheritdoc} */ - public function uri() { - return array( - 'path' => 'admin/config/regional/date-time/formats/manage/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - - /** - * {@inheritdoc} - */ public function getExportProperties() { $properties = parent::getExportProperties(); $names = array( diff --git a/core/modules/system/lib/Drupal/system/Entity/Menu.php b/core/modules/system/lib/Drupal/system/Entity/Menu.php index 4727f8a..0898744 100644 --- a/core/modules/system/lib/Drupal/system/Entity/Menu.php +++ b/core/modules/system/lib/Drupal/system/Entity/Menu.php @@ -28,6 +28,9 @@ * "id" = "id", * "label" = "label", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/structure/menu/manage/{menu}" * } * ) */ diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php index 8c20176..d1241a8 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Entity/Vocabulary.php @@ -37,6 +37,9 @@ * "label" = "name", * "weight" = "weight", * "uuid" = "uuid" + * }, + * links = { + * "edit-form" = "admin/structure/taxonomy/manage/{taxonomy_vocabulary}" * } * ) */ @@ -99,19 +102,6 @@ public function id() { /** * {@inheritdoc} */ - public function uri() { - return array( - 'path' => 'admin/structure/taxonomy/manage/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - - /** - * {@inheritdoc} - */ public function postSave(EntityStorageControllerInterface $storage_controller, $update = TRUE) { if (!$update) { entity_invoke_bundle_hook('create', 'taxonomy_term', $this->id()); diff --git a/core/modules/user/lib/Drupal/user/Entity/Role.php b/core/modules/user/lib/Drupal/user/Entity/Role.php index 8529e87..7ab545a 100644 --- a/core/modules/user/lib/Drupal/user/Entity/Role.php +++ b/core/modules/user/lib/Drupal/user/Entity/Role.php @@ -35,6 +35,9 @@ * "uuid" = "uuid", * "weight" = "weight", * "label" = "label" + * }, + * links = { + * "edit-form" = "admin/people/roles/manage/{user_role}" * } * ) */ @@ -78,19 +81,6 @@ class Role extends ConfigEntityBase implements RoleInterface { /** * {@inheritdoc} */ - public function uri() { - return array( - 'path' => 'admin/people/roles/manage/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - - /** - * {@inheritdoc} - */ public function getPermissions() { return $this->permissions; } diff --git a/core/modules/views/lib/Drupal/views/Entity/View.php b/core/modules/views/lib/Drupal/views/Entity/View.php index b8e69bd..7d90abe 100644 --- a/core/modules/views/lib/Drupal/views/Entity/View.php +++ b/core/modules/views/lib/Drupal/views/Entity/View.php @@ -33,6 +33,9 @@ * "label" = "label", * "uuid" = "uuid", * "status" = "status" + * }, + * links = { + * "edit-form" = "admin/structure/views/view/{view}" * } * ) */ @@ -135,19 +138,6 @@ public function getExecutable() { } /** - * Overrides Drupal\Core\Entity\EntityInterface::uri(). - */ - public function uri() { - return array( - 'path' => 'admin/structure/views/view/' . $this->id(), - 'options' => array( - 'entity_type' => $this->entityType, - 'entity' => $this, - ), - ); - } - - /** * Overrides Drupal\Core\Config\Entity\ConfigEntityBase::createDuplicate(). */ public function createDuplicate() {