Esempio n. 1
0
 /**
  * Initializes the widget
  * @throws \foundation\exception\InvalidConfigException
  */
 public function init()
 {
     if (is_string($this->config)) {
         throw new InvalidConfigException('"config" must be of type array.');
     }
     $this->assets = array('js' => YII_DEBUG ? 'foundation/foundation.alerts.js' : 'foundation.min.js');
     if (!isset($this->config)) {
         $this->config = array(Enum::COLOR_REGULAR => array(), Enum::COLOR_ALERT => array(), Enum::COLOR_SECONDARY => array(), Enum::COLOR_SUCCESS => array());
     }
     $this->htmlOptions = ArrayHelper::defaultValue('id', $this->getId(), $this->htmlOptions);
     parent::init();
 }
Esempio n. 2
0
 /**
  * Generates a button
  * @param string $label
  * @param array $htmlOptions
  * @return string the generated button.
  */
 public static function button($label = 'button', $htmlOptions = array())
 {
     $htmlOptions = ArrayHelper::defaultValue('name', \CHtml::ID_PREFIX . \CHtml::$count++, $htmlOptions);
     Html::clientChange('click', $htmlOptions);
     return static::btn('button', $label, $htmlOptions);
 }
Esempio n. 3
0
 /**
  * Generates a close link.
  * @param string $label the link label text.
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated link.
  */
 public static function closeLink($label = '×', $htmlOptions = array())
 {
     $htmlOptions = ArrayHelper::defaultValue('href', '#', $htmlOptions);
     ArrayHelper::addValue('class', 'close', $htmlOptions);
     return \CHtml::openTag('a', $htmlOptions) . $label . \CHtml::closeTag('a');
 }