LinkRelationType.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Drupal\Core\Http;
  3. use Drupal\Core\Plugin\PluginBase;
  4. /**
  5. * Defines a single link relationship type.
  6. */
  7. class LinkRelationType extends PluginBase implements LinkRelationTypeInterface {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function isRegistered() {
  12. return !$this->isExtension();
  13. }
  14. /**
  15. * {@inheritdoc}
  16. */
  17. public function isExtension() {
  18. return isset($this->pluginDefinition['uri']);
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function getRegisteredName() {
  24. return $this->isRegistered() ? $this->getPluginId() : NULL;
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function getExtensionUri() {
  30. return $this->isExtension() ? $this->pluginDefinition['uri'] : NULL;
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function getDescription() {
  36. return isset($this->pluginDefinition['description']) ? $this->pluginDefinition['description'] : '';
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function getReference() {
  42. return isset($this->pluginDefinition['reference']) ? $this->pluginDefinition['reference'] : '';
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function getNotes() {
  48. return isset($this->pluginDefinition['notes']) ? $this->pluginDefinition['notes'] : '';
  49. }
  50. }