/** * @param $fieldname * @param $type * @return static */ public static final function createByType($fieldname, $type) { switch ($type) { case static::Type_Text: return Text::create($fieldname); case static::Type_Password: return Password::create($fieldname); case static::Type_TextArea: return TextArea::create($fieldname); case static::Type_CheckGroup: return CheckGroup::create($fieldname); case static::Type_RadioGroup: return RadioGroup::create($fieldname); case static::Type_Select: return Select::create($fieldname); case static::Type_MultiSelect: return MultiSelect::create($fieldname); case static::Type_Image: return Image::create($fieldname); case static::Type_MultiImage: return MultiImage::create($fieldname); case static::Type_Tags: return Tags::create($fieldname); case static::Type_Article: return Article::create($fieldname); case static::Type_Date: return Date::create($fieldname); case static::Type_SelectItem: return SelectItem::create($fieldname); case static::Type_DateTime: return DateTime::create($fieldname); case static::Type_DateRange: return DateRange::create($fieldname); case static::Type_Appendable: return Appendable::create($fieldname); } }