1 | <?php |
||
29 | class Route extends FieldPluginBase implements ContainerFactoryPluginInterface { |
||
30 | |||
31 | /** |
||
32 | * The path validator service. |
||
33 | * |
||
34 | * @var \Drupal\Core\Path\PathValidatorInterface |
||
35 | */ |
||
36 | protected $pathValidator; |
||
37 | |||
38 | /** |
||
39 | * The language negotiator service. |
||
40 | * |
||
41 | * @var \Drupal\language\LanguageNegotiator |
||
42 | */ |
||
43 | protected $languageNegotiator; |
||
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { |
||
49 | return new static( |
||
50 | $configuration, |
||
51 | $plugin_id, |
||
52 | $plugin_definition, |
||
53 | $container->get('path.validator'), |
||
54 | $container->has('language_negotiator') ? $container->get('language_negotiator') : NULL |
||
55 | ); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Route constructor. |
||
60 | * |
||
61 | * @param array $configuration |
||
62 | * The plugin configuration. |
||
63 | * @param string $pluginId |
||
64 | * The plugin id. |
||
65 | * @param mixed $pluginDefinition |
||
66 | * The plugin definition. |
||
67 | * @param \Drupal\Core\Path\PathValidatorInterface $pathValidator |
||
68 | * The path validator service. |
||
69 | * @param \Drupal\language\LanguageNegotiator|null $languageNegotiator |
||
70 | * The language negotiator. |
||
71 | */ |
||
72 | public function __construct( |
||
83 | |||
84 | /** |
||
85 | * {@inheritdoc} |
||
86 | * |
||
87 | * Execute routing in language context. |
||
88 | * |
||
89 | * Language context has to be inferred from the path prefix, but set before |
||
90 | * `resolveValues` is invoked. |
||
91 | */ |
||
92 | public function resolve($value, array $args, ResolveContext $context, ResolveInfo $info) { |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | * |
||
106 | * Route field is always language aware since it sets it's context from |
||
107 | * the prefix. |
||
108 | */ |
||
109 | protected function isLanguageAwareField() { |
||
112 | |||
113 | /** |
||
114 | * {@inheritdoc} |
||
115 | */ |
||
116 | public function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) { |
||
124 | |||
125 | } |
||
126 |