summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls
diff options
context:
space:
mode:
authorctrlaltca <ctrlaltca@gmail.com>2016-04-04 18:31:15 +0200
committerctrlaltca <ctrlaltca@gmail.com>2016-04-04 18:31:15 +0200
commit471b5be786b797457bf59f3515a3664d18ed0fac (patch)
tree7f9198d8dd909fd3c31e64c186e7f14772963a7b /framework/Web/UI/WebControls
parent7e255537404cb6ceb5465589c87897781358bc59 (diff)
parent0bd656a197b5b37349cf39a8ec701625df92e797 (diff)
Merge pull request #579 from pradosoft/fix_562
Added TClientStyleSheet::PradoStyles
Diffstat (limited to 'framework/Web/UI/WebControls')
-rw-r--r--framework/Web/UI/WebControls/TStyleSheet.php46
1 files changed, 44 insertions, 2 deletions
diff --git a/framework/Web/UI/WebControls/TStyleSheet.php b/framework/Web/UI/WebControls/TStyleSheet.php
index 1964610f..021b9117 100644
--- a/framework/Web/UI/WebControls/TStyleSheet.php
+++ b/framework/Web/UI/WebControls/TStyleSheet.php
@@ -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());
}
/**