Esempio n. 1
0
 /**
  * (void) init :
  */
 public function init()
 {
     if (!isset($this->options['id']) && !$this->hasModel()) {
         $this->options['id'] = 'iconpicker_' . $this->getId();
     }
     parent::init();
     $this->_id = $this->options['id'];
     if ($this->hasModel() && !empty($this->model->{$this->attribute})) {
         $temArr = explode(' ', $this->model->{$this->attribute});
         if (count($temArr) > 1) {
             $this->_default = $this->pickerOptions['data-icon'] = $temArr[1];
         }
     }
     if (!$this->hasModel() && !empty($this->value)) {
         $this->_default = $this->pickerOptions['data-icon'] = $this->value;
     }
     if (!isset($this->pickerOptions['id'])) {
         $this->pickerOptions['id'] = $this->_id . '_jspicker';
     }
     if ($this->removePrefix) {
         $this->_default = $this->iconset == 'fontawesome' ? 'fa-' . $this->_default : 'glyphicon-' . $this->_default;
     }
     $this->registerAssets();
 }
Esempio n. 2
0
	<?php 
echo $form->field($model, 'code')->textInput(['maxlength' => true, 'placeholder' => Yii::t('setting', 'Code key of setting')]);
?>
	<?php 
echo $form->beginField($model, 'name');
?>
	<?php 
echo Html::activeLabel($model, 'name', ['class' => 'control-label']);
?>
	<?php 
if (in_array($model->type, [Setting::TYPE_GROUP, Setting::TYPE_ACTION])) {
    ?>
		<div class="input-group">
	    <span class="input-group-btn icon">
		    <?php 
    echo Iconpicker::widget(['model' => $model, 'attribute' => 'icon', 'pickerOptions' => ['class' => 'btn btn-default'], 'clientOptions' => ['placement' => 'bottom', 'search' => false]]);
    ?>
	    </span>
			<?php 
    echo Html::activeTextInput($model, 'name', ['class' => 'form-control']);
    ?>
		</div>
	<?php 
} else {
    ?>
		<?php 
    echo Html::activeTextInput($model, 'name', ['class' => 'form-control']);
    ?>
	<?php 
}
?>