Permalink
Browse files

added modules support

  • Loading branch information...
1 parent 91f57c9 commit 97cebe6182c07b5055890980eedeff2f98b330f4 @kolinger committed Jan 9, 2013
Showing with 33 additions and 2 deletions.
  1. +7 −2 Config/SquareExtension.php
  2. +26 −0 Modules/Module.php
@@ -25,6 +25,7 @@ class SquareExtension extends \Nette\Config\CompilerExtension
'namespaces' => array(
'App' => 10,
),
+ 'modules' => array(),
);
@@ -34,8 +35,12 @@ public function loadConfiguration()
$container = $this->getContainerBuilder();
$config = $this->getConfig($this->defaults);
- $presenterFactory = $container->getDefinition('nette.presenterFactory');
- $presenterFactory->setClass('Square\Application\PresenterFactory', array($config['namespaces']));
+ $container->getDefinition('nette.presenterFactory')
+ ->setClass('Square\Application\PresenterFactory', array($config['namespaces']));
+
+ foreach ($config['modules'] as $extension) {
+ $this->compiler->addExtension($extension::NAME, new $extension);
+ }
}
}
View
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * This file is part of the Square CMS
+ *
+ * Copyright (c) 2011, 2012 Tomáš Kolinger <tomas@kolinger.name>
+ *
+ * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
+ */
+
+namespace Square\Modules;
+
+
+
+/**
+ * @author Tomáš Kolinger <tomas@kolinger.name>
+ */
+abstract class Module extends \Nette\Config\CompilerExtension
+{
+
+ /**
+ * Module name
+ */
+ const NAME = NULL;
+
+}

0 comments on commit 97cebe6

Please sign in to comment.