public function timepickerInput($options = []) { TimePickerAsset::register($this->form->getView()); $this->registerScript($options); return parent::textInput(); }
public function begin() { if ($this->collapsed == true) { $this->options["class"] .= " collapsed-box"; } return parent::begin(); }
public function init(){ //Changing Input Options Merge with form-class $this->inputOptions = ['placeHolder' => $this->model->getAttributeLabel($this->attribute), 'class' => 'form-control']; parent::init(); }
/** * @inheritdoc */ public function checkbox($options = [], $enclosedByLabel = true) { if (isset($this->inputOptions['name'])) { $options['name'] = $this->inputOptions['name']; } return parent::checkbox($options, $enclosedByLabel); }
public function render($content = null) { if (!isset($this->parts['{hider}'])) { $this->parts['{hider}'] = "<a href='#' style = 'margin-top:2px;margin-bottom:2px;\n\t\tfloat: right;padding-right: 4px;padding-left: 5px;padding-top: 2px;padding-bottom: 0px'\n\t \tclass = 'btn btn-default put-on-cloak' value = {$this->attribute}><span style = 'color:#C0C0C0' class = 'glyphicon glyphicon-remove' ></a>"; } return parent::render(); }
public function dropDownList($items, $options = [], $generateDefault = true) { if ($generateDefault === true && !isset($options['prompt'])) { $options['prompt'] = '请选择'; } return parent::dropDownList($items, $options); }
public function init() { parent::init(); /*$this->owner->addRule($this->getAttributeName(), 'in', [ 'range' => $this->getOptions(), 'allowArray' => true, ]);*/ }
public function render($content = null) { if (!isset($this->parts['{hint}']) || $this->parts['{hint}'] === null) { $this->template = str_replace("\n{hint}", '', $this->template); } $this->prepareTemplate(); return parent::render($content); }
public function render($content = null) { $label = $this->model->getAttributeLabel($this->attribute); $this->html = ArrayHelper::merge(['caption' => $label], $this->html); $this->inputOptions['placeholder'] = $this->inputOptions['placeholder'] ? $this->inputOptions['placeholder'] : $label; $this->html['attr'] = $this->html['attr'] ? $this->html['attr'] . " placeholder='{$this->inputOptions['placeholder']}'" : "placeholder='{$this->inputOptions['placeholder']}'"; if ($this->form->autogenerate) { return ''; } $this->parts['{error}'] = ''; return parent::render($content); }
public function textarea($options = []) { if (!isset($options['rows'])) { $options['rows'] = 5; } return parent::textarea($options); }
/** * @inheritdoc */ public function widget($class, $config = []) { $config = array_merge(['options' => $this->inputOptions], $config); return parent::widget($class, $config); }
/** * @inheritdoc */ public function widget($class, $config = []) { if (property_exists($class, 'disabled') && property_exists($class, 'readonly')) { $this->initDisability($config); } return parent::widget($class, $config); }
/** * Returns the JS options for the field. * @return array the JS options */ public function getClientOptions() { return parent::getClientOptions(); }
/** * Renders switcher * @see http://materializecss.com/forms.html#switches * @param array $options * @param array $flags * @return $this */ public function switcher($options = [], $flags = null) { parent::checkbox($options, false); if ($flags === null) { $label = Html::encode($this->model->getAttributeLabel(Html::getAttributeName($this->attribute))); $labelParts = explode(',', $label); $flags = count($labelParts) >= 2 ? $labelParts : null; } if ($flags) { Html::removeCssClass($this->options, 'input-field'); Html::addCssClass($this->options, 'switch'); $labelContent = $flags[0] . $this->parts['{input}'] . Html::tag('span', '', ['class' => 'lever']) . $flags[1]; $this->parts['{input}'] = Html::label($labelContent, Html::getInputId($this->model, $this->attribute)); } return $this; }
public function checkbox($options = [], $enclosedByLabel = false) { parent::checkbox($options, $enclosedByLabel); return $this; }
/** * Skip \kartik\form\ActiveField::checkbox() * @see \kartik\form\ActiveField::checkbox() */ public function checkbox($options = [], $enclosedByLabel = true) { return grandParent::checkbox($options, $enclosedByLabel); }
/** * @inheritdoc */ public function render($content = null) { if ($this->getConfigParam('showHints') === false) { $this->hintOptions['hint'] = ''; } else { if ($content === null && !isset($this->parts['{hint}']) && !isset($this->hintOptions['hint'])) { $this->hintOptions['hint'] = $this->generateHint(); } $this->template = strtr($this->template, ['{hint}' => $this->_settings['hint']]); } if ($this->form->staticOnly === true) { $field = $this->staticInput(); $this->buildTemplate(); return parent::render(null); } $this->initPlaceholder($this->inputOptions); $this->initDisability($this->inputOptions); $this->buildTemplate(); return parent::render($content); }
/** * @inheritdoc */ public function checkboxList($items, $options = [], $item_options = []) { $options['item'] = function ($index, $label, $name, $checked, $value) use($item_options) { $options = ['value' => $value, 'label' => $label, 'ng-model' => 'data.' . $this->attribute . '.' . $value]; if (isset($item_options[$value])) { $options = array_merge($options, $item_options[$value]); } return Html::tag('md-checkbox', $label, $options); }; return parent::checkboxList($items, $options); }
public function render($content = null) { $this->inputOptions['placeholder'] = is_null($this->inputOptions['placeholder']) ? $this->model->getAttributeLabel($this->attribute) : null; $this->registerStyles(); return parent::render($content); }
/** * @inherit doc */ public function render($content = null) { if ($this->form->staticOnly === true) { $field = $this->staticInput(); $this->initTemplate(); $this->buildTemplate(); return parent::render(null); } $this->initTemplate(); $this->initPlaceholder($this->inputOptions); $this->initAddon(); $this->initDisability($this->inputOptions); $this->buildTemplate(); return parent::render($content); }
/** * Useful to test other methods from ActiveField, that call ActiveField::getClientOptions() * but it's return value is not relevant for the test being run. */ public function getClientOptions() { return $this->getClientOptionsEmpty ? [] : parent::getClientOptions(); }
/** * * Стандартная обработка поля формы. * * @param \yii\widgets\ActiveField $field * @return \yii\widgets\ActiveField */ public function postFieldRender(\yii\widgets\ActiveField $field) { if ($this->property->hint) { $field->hint((string) $this->property->hint); } if ($this->property->name) { $field->label($this->property->name); } else { $field->label(false); } return $field; }
/** * Initializes the widget. * This renders the form open tag. */ public function init() { if (!isset($this->options['id'])) { $this->options['id'] = $this->getId(); } if (!isset($this->fieldConfig['class'])) { $this->fieldConfig['class'] = ActiveField::className(); } echo Html::beginForm($this->action, $this->method, $this->options); }
public function render($content = null) { $this->registerStyles(); return parent::render($content); }
/** * @inheritdoc */ public function label($label = null, $options = []) { if (is_bool($label)) { $this->enableLabel = $label; if ($label === false && $this->form->layout === 'horizontal') { Html::addCssClass($this->wrapperOptions, $this->horizontalCssClasses['offset']); } } else { $this->enableLabel = true; $this->renderLabelParts($label, $options); parent::label($label, $options); } return $this; }
/** * @inheritdoc */ public function label($label = null, $options = []) { if (is_bool($label)) { $this->enableLabel = $label; } else { $this->enableLabel = true; $this->renderLabelParts($label, $options); parent::label($label, $options); } return $this; }
/** * @inheritdoc */ public function render($content = null) { if ($content === null) { if ($this->enableLabel === false) { $this->parts['{label}'] = ''; $this->parts['{beginLabel}'] = ''; $this->parts['{labelTitle}'] = ''; $this->parts['{endLabel}'] = ''; } elseif (!isset($this->parts['{beginLabel}'])) { $this->renderLabelParts(); } if ($this->enableError === false) { $this->parts['{error}'] = ''; } if ($this->inputTemplate) { $input = isset($this->parts['{input}']) ? $this->parts['{input}'] : Html::activeTextInput($this->model, $this->attribute, $this->inputOptions); $this->parts['{input}'] = strtr($this->inputTemplate, ['{input}' => $input]); } } return parent::render($content); }
/** * Renders a textarea. * @param array $options * @return ActiveField */ public function textarea($options = []) { Html::addCssClass($options, ['textarea' => 'materialize-textarea']); return parent::textarea($options); }
public function render($content = null) { $this->adaptField(); $this->processPrependAndAppend(); return parent::render($content); }
/** * @inheritdoc */ public function end() { $result = parent::end(); return str_replace('</div', '</dl', $result); }