d23e7d33682ca73ffadac10538391c9979a65730
[yaffs-website] / web / modules / contrib / linkit / src / Controller / LinkitController.php
1 <?php
2
3 /**
4  * @file
5  * Contains \Drupal\linkit\Controller\LinkitController.
6  */
7
8 namespace Drupal\linkit\Controller;
9
10 use Drupal\Core\Controller\ControllerBase;
11 use Drupal\linkit\ProfileInterface;
12
13 /**
14  * Provides route responses for linkit.module.
15  */
16 class LinkitController extends ControllerBase {
17
18   /**
19    * Route title callback.
20    *
21    * @param \Drupal\linkit\ProfileInterface $linkit_profile
22    *   The profile.
23    *
24    * @return string
25    *   The profile label as a render array.
26    */
27   public function profileTitle(ProfileInterface $linkit_profile) {
28     return $this->t('Edit %label profile', array('%label' => $linkit_profile->label()));
29   }
30
31   /**
32    * Route title callback.
33    *
34    * @param \Drupal\linkit\ProfileInterface $linkit_profile
35    *   The profile.
36    * @param string $plugin_instance_id
37    *   The plugin instance id.
38    *
39    * @return string
40    *   The title for the matcher edit form.
41    */
42   public function matcherTitle(ProfileInterface $linkit_profile, $plugin_instance_id) {
43     /** @var \Drupal\linkit\MatcherInterface $matcher */
44     $matcher = $linkit_profile->getMatcher($plugin_instance_id);
45     return $this->t('Edit %label matcher', array('%label' => $matcher->getLabel()));
46   }
47
48   /**
49    * Route title callback.
50    *
51    * @param \Drupal\linkit\ProfileInterface $linkit_profile
52    *   The profile.
53    * @param string $plugin_instance_id
54    *   The plugin instance id.
55    *
56    * @return string
57    *   The title for the attribute edit form.
58    */
59   public function attributeTitle(ProfileInterface $linkit_profile, $plugin_instance_id) {
60     /** @var \Drupal\linkit\AttributeInterface $attribute */
61     $attribute = $linkit_profile->getAttribute($plugin_instance_id);
62     return $this->t('Edit %label attribute', array('%label' => $attribute->getLabel()));
63   }
64
65 }