Zauberfisch / silverstripe-boilerplate

Boilerplate template to quickly kick off a new SilverStripe project
21 stars 3 forks source link

getCMSFields: set field max length according to db fields #22

Open Zauberfisch opened 10 years ago

Zauberfisch commented 10 years ago

check if we can make the default getCMSFields() loop through all fields and set the max length of text fields to the max length of the DB field

<@simon_w|air> greseky, $field = $this->dbObject('Field'); if ($field instanceof Varchar) $textField->setMaxLength($field->getSize())

use case: a field of type Varchar usually has a max length of 50, which for example can result in a cut of title after saving and confusing the CMS user