summaryrefslogtreecommitdiff
path: root/app/frontend/web/FacadeTemplateControl.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/frontend/web/FacadeTemplateControl.php')
-rw-r--r--app/frontend/web/FacadeTemplateControl.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/frontend/web/FacadeTemplateControl.php b/app/frontend/web/FacadeTemplateControl.php
new file mode 100644
index 0000000..05d148c
--- /dev/null
+++ b/app/frontend/web/FacadeTemplateControl.php
@@ -0,0 +1,27 @@
+<?php
+
+Prado::using('Application.facades.Facade');
+Prado::using('Application.web.TemplateControl');
+
+class FacadeTemplateControl extends TemplateControl {
+
+ public function setFacade(Facade $facade) {
+ $this->setControlState('Facade', $facade);
+ }
+
+ public function getFacade() {
+ return $this->getControlState('Facade');
+ }
+
+ public function onPreRender($param) {
+ parent::onPreRender($param);
+ if (!$this->getFacade()) {
+ throw new TInvalidDataValueException(
+ 'FacadeTemplateControl requires a Facade instance'
+ );
+ }
+ }
+
+}
+
+?>