OutputServiceProvider.php 899 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * @package Grav\Common\Service
  4. *
  5. * @copyright Copyright (c) 2015 - 2023 Trilby Media, LLC. All rights reserved.
  6. * @license MIT License; see LICENSE file for details.
  7. */
  8. namespace Grav\Common\Service;
  9. use Grav\Common\Page\Interfaces\PageInterface;
  10. use Grav\Common\Twig\Twig;
  11. use Pimple\Container;
  12. use Pimple\ServiceProviderInterface;
  13. /**
  14. * Class OutputServiceProvider
  15. * @package Grav\Common\Service
  16. */
  17. class OutputServiceProvider implements ServiceProviderInterface
  18. {
  19. /**
  20. * @param Container $container
  21. * @return void
  22. */
  23. public function register(Container $container)
  24. {
  25. $container['output'] = function ($c) {
  26. /** @var Twig $twig */
  27. $twig = $c['twig'];
  28. /** @var PageInterface $page */
  29. $page = $c['page'];
  30. return $twig->processSite($page->templateFormat());
  31. };
  32. }
  33. }