Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Method to register bootstrap js file.

  • Loading branch information...
commit 30f7e07a7262e5db2ce30589c3e970084f0d6e7f 1 parent 3e0979c
@thelfensdrfer thelfensdrfer authored
Showing with 21 additions and 3 deletions.
  1. +21 −3 EBootstrap.php
View
24 EBootstrap.php
@@ -15,7 +15,8 @@ class EBootstrap extends CHtml {
* @param array $option Classes to modify
* @param array $add Classes to add
*/
- public static function mergeClass(array &$option, array $add) {
+ public static function mergeClass(array &$option, array $add)
+ {
if (isset($option['class']) and (!empty($option['class']))) {
foreach ($add as $k => $v) {
$option['class'] .= ' '.$v;
@@ -31,20 +32,37 @@ public static function mergeClass(array &$option, array $add) {
* @param string $class Classes string
* @param array $add Classes to add
*/
- public static function mergeClassString(&$class, array $add) {
+ public static function mergeClassString(&$class, array $add)
+ {
if (!empty($class))
$class .= ' ';
$class .= implode(' ', $add);
}
/**
+ * Register the build in js file
+ *
+ * @param integer $position
+ *
+ * @access public
+ * @return ClientScript
+ */
+ public static function registerJs($position=NULL)
+ {
+ $jsFile = dirname(__FILE__).'/js/bootstrap.min.js';
+ $js = Yii::app()->assetManager->publish($jsFile);
+ return Yii::app()->clientScript->registerScriptFile($js, $position);
+ }
+
+ /**
* Returns an inline label
*
* @param string $label Label
* @param string $type success|warning|important|info. Leave empty for default
* @param array $htmlOptions
*/
- public static function ilabel($label, $type='', $htmlOptions=array()) {
+ public static function ilabel($label, $type='', $htmlOptions=array())
+ {
$classes = array('label');
if (!empty($type))
$classes[] = 'label-'.$type;
Please sign in to comment.
Something went wrong with that request. Please try again.