예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function getDefinitions()
 {
     $plugins = $this->discovery->findAll();
     // Flatten definitions into what's expected from plugins.
     $definitions = array();
     foreach ($plugins as $provider => $list) {
         foreach ($list as $id => $definition) {
             // Add TranslatableMarkup.
             foreach ($this->translatableProperties as $property => $context_key) {
                 if (isset($definition[$property])) {
                     $options = [];
                     // Move the t() context from the definition to the translation
                     // wrapper.
                     if ($context_key && isset($definition[$context_key])) {
                         $options['context'] = $definition[$context_key];
                         unset($definition[$context_key]);
                     }
                     $definition[$property] = new TranslatableMarkup($definition[$property], [], $options);
                 }
             }
             // Add ID and provider.
             $definitions[$id] = $definition + array('provider' => $provider, 'id' => $id);
         }
     }
     return $definitions;
 }
예제 #2
0
 /**
  * Retrieves all defined routes from .routing.yml files.
  *
  * @return array
  *   The defined routes, keyed by provider.
  */
 protected function getRouteDefinitions()
 {
     // Always instantiate a new YamlDiscovery object so that we always search on
     // the up-to-date list of modules.
     $discovery = new YamlDiscovery('routing', $this->moduleHandler->getModuleDirectories());
     return $discovery->findAll();
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 protected function getRouteDefinitions()
 {
     return $this->yamlDiscovery->findAll();
 }