You are here

class LinkManager in Drupal 8

Same name in this branch
  1. 8 core/modules/hal/src/LinkManager/LinkManager.php \Drupal\hal\LinkManager\LinkManager
  2. 8 core/modules/rest/src/LinkManager/LinkManager.php \Drupal\rest\LinkManager\LinkManager
Same name and namespace in other branches
  1. 9 core/modules/hal/src/LinkManager/LinkManager.php \Drupal\hal\LinkManager\LinkManager

Hierarchy

Expanded class hierarchy of LinkManager

1 file declares its use of LinkManager
LinkManager.php in core/modules/rest/src/LinkManager/LinkManager.php
1 string reference to 'LinkManager'
hal.services.yml in core/modules/hal/hal.services.yml
core/modules/hal/hal.services.yml
1 service uses LinkManager
hal.link_manager in core/modules/hal/hal.services.yml
Drupal\hal\LinkManager\LinkManager

File

core/modules/hal/src/LinkManager/LinkManager.php, line 5

Namespace

Drupal\hal\LinkManager
View source
class LinkManager implements LinkManagerInterface {

  /**
   * The type link manager.
   *
   * @var \Drupal\hal\LinkManager\TypeLinkManagerInterface
   */
  protected $typeLinkManager;

  /**
   * The relation link manager.
   *
   * @var \Drupal\hal\LinkManager\RelationLinkManagerInterface
   */
  protected $relationLinkManager;

  /**
   * Constructor.
   *
   * @param \Drupal\hal\LinkManager\TypeLinkManagerInterface $type_link_manager
   *   Manager for handling bundle URIs.
   * @param \Drupal\hal\LinkManager\RelationLinkManagerInterface $relation_link_manager
   *   Manager for handling bundle URIs.
   */
  public function __construct(TypeLinkManagerInterface $type_link_manager, RelationLinkManagerInterface $relation_link_manager) {
    $this->typeLinkManager = $type_link_manager;
    $this->relationLinkManager = $relation_link_manager;
  }

  /**
   * {@inheritdoc}
   */
  public function getTypeUri($entity_type, $bundle, $context = []) {
    return $this->typeLinkManager
      ->getTypeUri($entity_type, $bundle, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function getTypeInternalIds($type_uri, $context = []) {
    return $this->typeLinkManager
      ->getTypeInternalIds($type_uri, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function getRelationUri($entity_type, $bundle, $field_name, $context = []) {
    return $this->relationLinkManager
      ->getRelationUri($entity_type, $bundle, $field_name, $context);
  }

  /**
   * {@inheritdoc}
   */
  public function getRelationInternalIds($relation_uri) {
    return $this->relationLinkManager
      ->getRelationInternalIds($relation_uri);
  }

  /**
   * {@inheritdoc}
   */
  public function setLinkDomain($domain) {
    $this->relationLinkManager
      ->setLinkDomain($domain);
    $this->typeLinkManager
      ->setLinkDomain($domain);
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LinkManager::$relationLinkManager protected property The relation link manager.
LinkManager::$typeLinkManager protected property The type link manager.
LinkManager::getRelationInternalIds public function Translates a REST URI into internal IDs. Overrides RelationLinkManagerInterface::getRelationInternalIds
LinkManager::getRelationUri public function Gets the URI that corresponds to a field. Overrides RelationLinkManagerInterface::getRelationUri
LinkManager::getTypeInternalIds public function Get a bundle's Typed Data IDs based on a URI. Overrides TypeLinkManagerInterface::getTypeInternalIds
LinkManager::getTypeUri public function Gets the URI that corresponds to a bundle. Overrides TypeLinkManagerInterface::getTypeUri
LinkManager::setLinkDomain public function Sets the link domain used in constructing link URIs. Overrides ConfigurableLinkManagerInterface::setLinkDomain
LinkManager::__construct public function Constructor.