/** * The the default values to attributes * @param BModel $model An instance of BModel * @param array $attributes The list of attributes that will be set default. If the $attributes is empty, * all the save attributes will be set default */ public function setDefault($model, $attributes = []) { if (!$attributes) { $attributes = $model->getSaveAttributesName(); } foreach ($attributes as $att) { $this->tag->setDefault($att, $model->{$att}); } }
/** * Display attribute name * @param string $attribute * @return string */ public function label($attribute) { return Tag::tagHtml('label', ['class' => 'pull-left control-label']) . $this->model->getAttributeLabel($attribute) . Tag::tagHtmlClose('label', true); }