Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core/View
diff options
context:
space:
mode:
authordiosmosis <benakamoorthi@fastmail.fm>2014-02-11 18:42:58 +0400
committerdiosmosis <benakamoorthi@fastmail.fm>2014-02-11 18:42:58 +0400
commit0ec34a44d60f40b8db439f97cfa3547abcf8e3e5 (patch)
tree327416e9b173442a931e50b17f1cb8f20a2f0549 /core/View
parent6435f2f03442e4ed8a57fc0d0dbca15a3e1a01f0 (diff)
Fix bug in UIControl where override template vars are not passed to inner view and have no effect.
Diffstat (limited to 'core/View')
-rw-r--r--core/View/UIControl.php65
1 files changed, 44 insertions, 21 deletions
diff --git a/core/View/UIControl.php b/core/View/UIControl.php
index 0590fe2552..111ef58133 100644
--- a/core/View/UIControl.php
+++ b/core/View/UIControl.php
@@ -28,22 +28,6 @@ class UIControl extends \Piwik\View
const TEMPLATE = '';
/**
- * Holds the array of values that are passed to the UIControl JavaScript class.
- *
- * @var array
- */
- public $clientSideProperties = array();
-
- /**
- * Holds an array of values that are passed to the UIControl JavaScript class. These values
- * differ from those in {@link $clientSideProperties} in that they are meant to passed as
- * request parameters when the JavaScript code makes an AJAX request.
- *
- * @var array
- */
- public $clientSideParameters = array();
-
- /**
* The CSS class that is used to map the root element of this control with the JavaScript class.
*
* This field must be set prior to rendering.
@@ -86,9 +70,6 @@ class UIControl extends \Piwik\View
$this->innerView = new View(static::TEMPLATE);
parent::__construct("@CoreHome\_uiControl");
-
- $this->clientSideProperties = array();
- $this->clientSideParameters = array();
}
/**
@@ -133,12 +114,54 @@ class UIControl extends \Piwik\View
public function getTemplateVars($override = array())
{
$this->templateVars['implView'] = $this->innerView;
- $this->templateVars['clientSideProperties'] = $this->clientSideProperties;
- $this->templateVars['clientSideParameters'] = $this->clientSideParameters;
$this->templateVars['cssIdentifier'] = $this->cssIdentifier;
$this->templateVars['cssClass'] = $this->cssClass;
$this->templateVars['jsClass'] = $this->jsClass;
+ $this->templateVars['implOverride'] = $override;
+
+ $innerTemplateVars = $this->innerView->getTemplateVars($override);
+
+ $this->templateVars['clientSideProperties'] = array();
+ foreach ($this->getClientSideProperties() as $name) {
+ $this->templateVars['clientSideProperties'][$name] = $innerTemplateVars[$name];
+ }
+
+ $this->templateVars['clientSideParameters'] = array();
+ $clientSideParameters = $this->getClientSideParameters();
+ foreach ($this->getClientSideParameters() as $name) {
+ $this->templateVars['clientSideParameters'][$name] = $innerTemplateVars[$name];
+ }
+
+ if ($this instanceof \Piwik\Plugins\SegmentEditor\SegmentSelectorControl) {
+ \Piwik\Log::warning(print_r($override, true));
+ }
return parent::getTemplateVars($override);
}
+
+ /**
+ * Returns the array of property names whose values are passed to the UIControl JavaScript class.
+ *
+ * Should be overriden by descendants.
+ *
+ * @return array
+ */
+ public function getClientSideProperties()
+ {
+ return array();
+ }
+
+ /**
+ * Returns an array of property names whose values are passed to the UIControl JavaScript class.
+ * These values differ from those in {@link $clientSideProperties} in that they are meant to passed as
+ * request parameters when the JavaScript code makes an AJAX request.
+ *
+ * Should be overriden by descendants.
+ *
+ * @return array
+ */
+ public function getClientSideParameters()
+ {
+ return array();
+ }
} \ No newline at end of file