예제 #1
0
 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');
 }
예제 #2
0
 /**
  * @return array|null
  */
 public function value()
 {
     $value = parent::value();
     if (!$value) {
         $value = array();
     }
     return $value;
 }
예제 #3
0
 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;
 }
예제 #4
0
 /**
  * @param $default
  * @return $this
  */
 public function setDefault($default)
 {
     parent::setDefault($default);
     return $this->setSelected($default);
 }
예제 #5
0
 /**
  * @param $default
  * @return $this
  */
 public function setDefault($default)
 {
     parent::setDefault($default);
     $this->setItemId($default);
     return $this;
 }
예제 #6
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->setRules('date');
 }