X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fdrupal-extension%2Fsrc%2FDrupal%2FDrupalExtension%2FCompiler%2FDriverPass.php;fp=vendor%2Fdrupal%2Fdrupal-extension%2Fsrc%2FDrupal%2FDrupalExtension%2FCompiler%2FDriverPass.php;h=6fc862a5235d9cfc86b2b71b0e672f654d627696;hp=0000000000000000000000000000000000000000;hb=1270d9129ce8f27c9b28b10518e32132c58e0aca;hpb=c27c0f0cdaa3f354b1fe54a56ae7e854be6e3f68 diff --git a/vendor/drupal/drupal-extension/src/Drupal/DrupalExtension/Compiler/DriverPass.php b/vendor/drupal/drupal-extension/src/Drupal/DrupalExtension/Compiler/DriverPass.php new file mode 100644 index 000000000..6fc862a52 --- /dev/null +++ b/vendor/drupal/drupal-extension/src/Drupal/DrupalExtension/Compiler/DriverPass.php @@ -0,0 +1,53 @@ +hasDefinition('drupal.drupal')) { + return; + } + + $drupalDefinition = $container->getDefinition('drupal.drupal'); + foreach ($container->findTaggedServiceIds('drupal.driver') as $id => $attributes) { + foreach ($attributes as $attribute) { + if (isset($attribute['alias']) && $name = $attribute['alias']) { + $drupalDefinition->addMethodCall( + 'registerDriver', array($name, new Reference($id)) + ); + } + } + + // If this is Drupal Driver, then a core controller needs to be + // instantiated as well. + if ('drupal.driver.drupal' === $id) { + $drupalDriverDefinition = $container->getDefinition($id); + $availableCores = array(); + foreach ($container->findTaggedServiceIds('drupal.core') as $coreId => $coreAttributes) { + foreach ($coreAttributes as $attribute) { + if (isset($attribute['alias']) && $name = $attribute['alias']) { + $availableCores[$name] = $container->getDefinition($coreId); + } + } + } + $drupalDriverDefinition->addMethodCall( + 'setCore', array($availableCores) + ); + } + } + + $drupalDefinition->addMethodCall( + 'setDefaultDriverName', array($container->getParameter('drupal.drupal.default_driver')) + ); + } +}