Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\hal\LinkManager;
|
Chris@0
|
4
|
Chris@0
|
5 class LinkManager implements LinkManagerInterface {
|
Chris@0
|
6
|
Chris@0
|
7 /**
|
Chris@0
|
8 * The type link manager.
|
Chris@0
|
9 *
|
Chris@0
|
10 * @var \Drupal\hal\LinkManager\TypeLinkManagerInterface
|
Chris@0
|
11 */
|
Chris@0
|
12 protected $typeLinkManager;
|
Chris@0
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 * The relation link manager.
|
Chris@0
|
16 *
|
Chris@0
|
17 * @var \Drupal\hal\LinkManager\RelationLinkManagerInterface
|
Chris@0
|
18 */
|
Chris@0
|
19 protected $relationLinkManager;
|
Chris@0
|
20
|
Chris@0
|
21 /**
|
Chris@0
|
22 * Constructor.
|
Chris@0
|
23 *
|
Chris@0
|
24 * @param \Drupal\hal\LinkManager\TypeLinkManagerInterface $type_link_manager
|
Chris@0
|
25 * Manager for handling bundle URIs.
|
Chris@0
|
26 * @param \Drupal\hal\LinkManager\RelationLinkManagerInterface $relation_link_manager
|
Chris@0
|
27 * Manager for handling bundle URIs.
|
Chris@0
|
28 */
|
Chris@0
|
29 public function __construct(TypeLinkManagerInterface $type_link_manager, RelationLinkManagerInterface $relation_link_manager) {
|
Chris@0
|
30 $this->typeLinkManager = $type_link_manager;
|
Chris@0
|
31 $this->relationLinkManager = $relation_link_manager;
|
Chris@0
|
32 }
|
Chris@0
|
33
|
Chris@0
|
34 /**
|
Chris@0
|
35 * {@inheritdoc}
|
Chris@0
|
36 */
|
Chris@0
|
37 public function getTypeUri($entity_type, $bundle, $context = []) {
|
Chris@0
|
38 return $this->typeLinkManager->getTypeUri($entity_type, $bundle, $context);
|
Chris@0
|
39 }
|
Chris@0
|
40
|
Chris@0
|
41 /**
|
Chris@0
|
42 * {@inheritdoc}
|
Chris@0
|
43 */
|
Chris@0
|
44 public function getTypeInternalIds($type_uri, $context = []) {
|
Chris@0
|
45 return $this->typeLinkManager->getTypeInternalIds($type_uri, $context);
|
Chris@0
|
46 }
|
Chris@0
|
47
|
Chris@0
|
48 /**
|
Chris@0
|
49 * {@inheritdoc}
|
Chris@0
|
50 */
|
Chris@0
|
51 public function getRelationUri($entity_type, $bundle, $field_name, $context = []) {
|
Chris@0
|
52 return $this->relationLinkManager->getRelationUri($entity_type, $bundle, $field_name, $context);
|
Chris@0
|
53 }
|
Chris@0
|
54
|
Chris@0
|
55 /**
|
Chris@0
|
56 * {@inheritdoc}
|
Chris@0
|
57 */
|
Chris@0
|
58 public function getRelationInternalIds($relation_uri) {
|
Chris@0
|
59 return $this->relationLinkManager->getRelationInternalIds($relation_uri);
|
Chris@0
|
60 }
|
Chris@0
|
61
|
Chris@0
|
62 /**
|
Chris@0
|
63 * {@inheritdoc}
|
Chris@0
|
64 */
|
Chris@0
|
65 public function setLinkDomain($domain) {
|
Chris@0
|
66 $this->relationLinkManager->setLinkDomain($domain);
|
Chris@0
|
67 $this->typeLinkManager->setLinkDomain($domain);
|
Chris@0
|
68 return $this;
|
Chris@0
|
69 }
|
Chris@0
|
70
|
Chris@0
|
71 }
|