core/core.link_relation.yml | 4 ++-- core/lib/Drupal/Core/Http/LinkRelation.php | 3 +-- core/modules/rest/src/Plugin/rest/resource/EntityResource.php | 7 ++++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/core.link_relation.yml b/core/core.link_relation.yml index 4ba0de9..ef26ee9 100644 --- a/core/core.link_relation.yml +++ b/core/core.link_relation.yml @@ -1,4 +1,4 @@ -# This are Drupal specific link relations. +# These are Drupal-specific link relations. add-form: relationship: https://drupal.org/link-relations/add-form description: A form where a resource of this type can be created @@ -6,7 +6,7 @@ create: relationship: https://drupal.org/link-relations/create description: A REST resource URL where a resource of this type can be created -# These are the one from IANA itself. +# These are the ones from IANA itself. about: description: "Refers to a resource that is the subject of the link's context." reference: '[RFC6903], section 2' diff --git a/core/lib/Drupal/Core/Http/LinkRelation.php b/core/lib/Drupal/Core/Http/LinkRelation.php index 4750941..98e84e2 100644 --- a/core/lib/Drupal/Core/Http/LinkRelation.php +++ b/core/lib/Drupal/Core/Http/LinkRelation.php @@ -6,8 +6,6 @@ /** * Defines a single link relationship. - * - * @todo pointing to actual documentation. */ class LinkRelation extends PluginBase implements LinkRelationInterface { @@ -29,6 +27,7 @@ public function getRelationshipUrl() { * {@inheritdoc} */ public function getDescription() { + return isset($this->pluginDefinition['description']) ? $this->pluginDefinition['description'] : ''; } /** diff --git a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php index 944a004..436dbfe 100644 --- a/core/modules/rest/src/Plugin/rest/resource/EntityResource.php +++ b/core/modules/rest/src/Plugin/rest/resource/EntityResource.php @@ -11,6 +11,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityStorageException; +use Drupal\Core\Http\LinkRelationManagerInterface; use Drupal\rest\Plugin\ResourceBase; use Drupal\rest\ResourceResponse; use Psr\Log\LoggerInterface; @@ -55,7 +56,7 @@ class EntityResource extends ResourceBase implements DependentPluginInterface { /** * The link relation manager used to create HTTP header links. * - * @var \Drupal\Component\Plugin\PluginManagerInterface + * @var \Drupal\Core\Http\LinkRelationManagerInterface */ protected $linkRelationManager; @@ -76,10 +77,10 @@ class EntityResource extends ResourceBase implements DependentPluginInterface { * A logger instance. * @param \Drupal\Core\Config\ConfigFactoryInterface * The config factory. - * @param \Drupal\Component\Plugin\PluginManagerInterface $link_relation_manager + * @param \Drupal\Core\Http\LinkRelationManagerInterface $link_relation_manager * The link relation manager. */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, $serializer_formats, LoggerInterface $logger, ConfigFactoryInterface $config_factory, PluginManagerInterface $link_relation_manager) { + public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, $serializer_formats, LoggerInterface $logger, ConfigFactoryInterface $config_factory, LinkRelationManagerInterface $link_relation_manager) { parent::__construct($configuration, $plugin_id, $plugin_definition, $serializer_formats, $logger); $this->entityType = $entity_type_manager->getDefinition($plugin_definition['entity_type']); $this->configFactory = $config_factory;