summaryrefslogtreecommitdiff
path: root/framework/Web/UI
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web/UI')
-rw-r--r--framework/Web/UI/ActiveControls/TActivePageAdapter.php9
-rw-r--r--framework/Web/UI/TClientScriptManager.php20
2 files changed, 22 insertions, 7 deletions
diff --git a/framework/Web/UI/ActiveControls/TActivePageAdapter.php b/framework/Web/UI/ActiveControls/TActivePageAdapter.php
index d90d0997..03fe2f16 100644
--- a/framework/Web/UI/ActiveControls/TActivePageAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActivePageAdapter.php
@@ -56,6 +56,10 @@ class TActivePageAdapter extends TControlAdapter
*/
const CALLBACK_STYLESHEETLIST_HEADER = 'X-PRADO-STYLESHEETLIST';
/**
+ * Stylesheet header name.
+ */
+ const CALLBACK_STYLESHEET_HEADER = 'X-PRADO-STYLESHEET';
+ /**
* Hidden field list header name.
*/
const CALLBACK_HIDDENFIELDLIST_HEADER = 'X-PRADO-HIDDENFIELDLIST';
@@ -212,6 +216,11 @@ class TActivePageAdapter extends TControlAdapter
if (count($stylesheets)>0)
$this->appendContentPart($response, self::CALLBACK_STYLESHEETLIST_HEADER, TJavaScript::jsonEncode($stylesheets));
+ // collect all stylesheet snippets references
+ $stylesheets = $cs->getStyleSheetCodes();
+ if (count($stylesheets)>0)
+ $this->appendContentPart($response, self::CALLBACK_STYLESHEET_HEADER, TJavaScript::jsonEncode($stylesheets));
+
// collect all script file references
$scripts = $cs->getScriptUrls();
if (count($scripts)>0)
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index 0cdf3e32..ea828187 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -402,17 +402,14 @@ class TClientScriptManager extends TApplicationComponent
/**
* Returns the URLs of all stylesheet files referenced on the page
- * @return array Combined list of all stylesheet urls used in the page
+ * @return array List of all stylesheet urls used in the page
*/
public function getStyleSheetUrls()
{
$stylesheets = array_values(
- array_merge(
- array_map(
- create_function('$e', 'return is_array($e) ? $e[0] : $e;'),
- $this->_styleSheetFiles),
- $this->_styleSheets
- )
+ array_map(
+ create_function('$e', 'return is_array($e) ? $e[0] : $e;'),
+ $this->_styleSheetFiles)
);
foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url)
@@ -425,6 +422,15 @@ class TClientScriptManager extends TApplicationComponent
}
/**
+ * Returns all the stylesheet code snippets referenced on the page
+ * @return array List of all stylesheet snippets used in the page
+ */
+ public function getStyleSheetCodes()
+ {
+ return array_unique(array_values($this->_styleSheets));
+ }
+
+ /**
* Registers a javascript file in the page head
* @param string a unique key identifying the file
* @param string URL to the javascript file