summaryrefslogtreecommitdiff
path: root/lib/prado/framework/Web/UI/WebControls/TStyleSheet.php
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-04-07 16:09:16 +0200
committeremkael <emkael@tlen.pl>2016-04-07 16:09:16 +0200
commitd42b25cbf6d3f1e51cb2a3149f1ff54cc5474bc9 (patch)
tree96b734357392d6094cfc5f8284ad8f2578b96b7f /lib/prado/framework/Web/UI/WebControls/TStyleSheet.php
parentac6c2b9c4f787dfdfa00547f764c77d80dad14c0 (diff)
* Prado upgrade (to 3.3.r6b8e6601752b21a8a96c385a5529bbec7bb2b408)
Diffstat (limited to 'lib/prado/framework/Web/UI/WebControls/TStyleSheet.php')
-rw-r--r--lib/prado/framework/Web/UI/WebControls/TStyleSheet.php48
1 files changed, 45 insertions, 3 deletions
diff --git a/lib/prado/framework/Web/UI/WebControls/TStyleSheet.php b/lib/prado/framework/Web/UI/WebControls/TStyleSheet.php
index ae5692d..021b911 100644
--- a/lib/prado/framework/Web/UI/WebControls/TStyleSheet.php
+++ b/lib/prado/framework/Web/UI/WebControls/TStyleSheet.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link https://github.com/pradosoft/prado
- * @copyright Copyright &copy; 2005-2015 The PRADO Group
+ * @copyright Copyright &copy; 2005-2016 The PRADO Group
* @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
* @package System.Web.UI.WebControls
*/
@@ -13,7 +13,17 @@
* TStyleSheet class.
*
* TStyleSheet represents the link to a stylesheet file and/or a piece of
- * stylesheet code. To specify the link to a CSS file, set {@link setStyleSheetUrl StyleSheetUrl}.
+ * stylesheet code. To specify the link to a CSS file, set {@link setStyleSheetUrl
+ * StyleSheetUrl}.
+ * Since Prado 3.3.1, it' possible to import css libraries bundled with
+ * Prado from template via the {@link setPradoStyles PradoStyles} property.
+ * Multiple Prado libraries can be specified using comma delimited string of the
+ * css library to include on the page. For example,
+ *
+ * <code>
+ * <com:TStyleSheet PradoStyles="bootstrap, jquery.ui.progressbar" />
+ * </code>
+ *
* The child rendering result of TStyleSheet is treated as CSS code and
* is rendered within an appropriate style HTML element.
* Therefore, if the child content is not empty, you should place the TStyleSheet
@@ -29,6 +39,29 @@
class TStyleSheet extends TControl
{
/**
+ * @return string comma delimited list of css libraries to include
+ * on the page.
+ * @since 3.3.1
+ */
+ public function getPradoStyles()
+ {
+ return $this->getViewState('PradoStyles', '');
+ }
+
+ /**
+ * Include css library to the current page. The current supported
+ * libraries are: "jquery-ui", "bootstrap" and all the split
+ * jquery.ui.componentname libraries.
+ *
+ * @param string comma delimited list of css libraries to include.
+ * @since 3.3.1
+ */
+ public function setPradoStyles($value)
+ {
+ $this->setViewState('PradoStyles', $value, '');
+ }
+
+ /**
* @param string URL to the stylesheet file
*/
public function setStyleSheetUrl($value)
@@ -67,8 +100,17 @@ class TStyleSheet extends TControl
*/
public function onPreRender($param)
{
+ $cs = $this->getPage()->getClientScript();
+
+ $styles = preg_split('/,|\s+/', $this->getPradoStyles());
+ foreach($styles as $style)
+ {
+ if(($style = trim($style))!=='')
+ $cs->registerPradoStyle($style);
+ }
+
if(($url=$this->getStyleSheetUrl())!=='')
- $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url,$this->getMediaType());
+ $cs->registerStyleSheetFile($url,$url,$this->getMediaType());
}
/**