aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/controller
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2013-07-04 11:08:36 -0500
committerNathaniel Guse <nathaniel.guse@gmail.com>2013-07-04 11:08:36 -0500
commit2fb48d60f1b8ea111c766d6d9e7a3dde2b8a4e74 (patch)
tree94f7b4ff1341ffc23dbbec62e945920bcd48f4b8 /phpBB/includes/controller
parent81f27fd87ee2e8ffc1ad1ad06c5b255c5436e86c (diff)
downloadforums-2fb48d60f1b8ea111c766d6d9e7a3dde2b8a4e74.tar
forums-2fb48d60f1b8ea111c766d6d9e7a3dde2b8a4e74.tar.gz
forums-2fb48d60f1b8ea111c766d6d9e7a3dde2b8a4e74.tar.bz2
forums-2fb48d60f1b8ea111c766d6d9e7a3dde2b8a4e74.tar.xz
forums-2fb48d60f1b8ea111c766d6d9e7a3dde2b8a4e74.zip
[feature/twig] Attempt to automatically set style dir for ext controllers
Extension authors can change it themselves if necessary PHPBB3-11598
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..2c7d112748 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)
{
$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 ($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);
}