aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/controller
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2013-07-11 12:11:41 -0700
committerNils Adermann <naderman@naderman.de>2013-07-11 12:11:41 -0700
commit59f34bef087259722e1f7eaa95b96460e007cb30 (patch)
treed7dfcc712537e672a965d924cac679670d09583e /phpBB/includes/controller
parent7104aeb77e2f6066cbbda0585fc8523426e4b7c7 (diff)
parent947b907efef43704c620507db17aff4fe115f219 (diff)
downloadforums-59f34bef087259722e1f7eaa95b96460e007cb30.tar
forums-59f34bef087259722e1f7eaa95b96460e007cb30.tar.gz
forums-59f34bef087259722e1f7eaa95b96460e007cb30.tar.bz2
forums-59f34bef087259722e1f7eaa95b96460e007cb30.tar.xz
forums-59f34bef087259722e1f7eaa95b96460e007cb30.zip
Merge pull request #1470 from EXreaction/feature/twig
Feature/twig
Diffstat (limited to 'phpBB/includes/controller')
-rw-r--r--phpBB/includes/controller/resolver.php28
1 files changed, 27 insertions, 1 deletions
diff --git a/phpBB/includes/controller/resolver.php b/phpBB/includes/controller/resolver.php
index ee469aa9c8..95dfc8da8e 100644
--- a/phpBB/includes/controller/resolver.php
+++ b/phpBB/includes/controller/resolver.php
@@ -38,15 +38,23 @@ class phpbb_controller_resolver implements ControllerResolverInterface
protected $container;
/**
+ * phpbb_style object
+ * @var phpbb_style
+ */
+ protected $style;
+
+ /**
* Construct method
*
* @param phpbb_user $user User Object
* @param ContainerInterface $container ContainerInterface object
+ * @param phpbb_style $style
*/
- public function __construct(phpbb_user $user, ContainerInterface $container)
+ public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null)
{
$this->user = $user;
$this->container = $container;
+ $this->style = $style;
}
/**
@@ -80,6 +88,24 @@ class phpbb_controller_resolver implements ControllerResolverInterface
$controller_object = $this->container->get($service);
+ /*
+ * If this is an extension controller, we'll try to automatically set
+ * the style paths for the extension (the ext author can change them
+ * if necessary).
+ */
+ $controller_dir = explode('_', get_class($controller_object));
+
+ // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ...
+ if (!is_null($this->style) && isset($controller_dir[3]) && $controller_dir[1] === 'ext')
+ {
+ $controller_style_dir = 'ext/' . $controller_dir[2] . '/' . $controller_dir[3] . '/styles';
+
+ if (is_dir($controller_style_dir))
+ {
+ $this->style->set_style(array($controller_style_dir, 'styles'));
+ }
+ }
+
return array($controller_object, $method);
}