public function label() { $width = $this->width() ? $this->width() : '不限'; $height = $this->height() ? $this->height() : '不限'; $size = $this->size() ? $this->size() : '不限'; return parent::label() . static::tooltip("宽度{$width}高度{$height}尺寸{$size}", 'picture'); }
/** * @return array|null */ public function value() { $value = parent::value(); if (!$value) { $value = array(); } return $value; }
public static function bindFormActionTags($form, $item = null, $id = 0) { if (!isset(static::$tagTypes)) { $types = ['default' => '标签']; } else { $types = static::$tagTypes; } foreach ($types as $type => $lable) { $form->addField(\FormFieldBase::createByType('tags_' . $type, \FormFieldBase::Type_Tags)->setLabel($lable)->setDefault([])); if (null != $item && 0 !== $id) { $form->setDefault('tags_' . $type, $item->tagNameArray($type)); } $form->setSaveFunc('tags_' . $type, function ($item, $form, $field) { $tags = $field->value(); $name = $field->name(); $type = substr($name, 5); //TagModel::setTags( $item , $tags , $type ); $item->modifiedTags[$type] = $tags; return $item; }); } return $form; }
/** * @param $default * @return $this */ public function setDefault($default) { parent::setDefault($default); return $this->setSelected($default); }
/** * @param $default * @return $this */ public function setDefault($default) { parent::setDefault($default); $this->setItemId($default); return $this; }
public function __construct($name) { parent::__construct($name); $this->setRules('date'); }