mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #1162 from dhensby/patch-1
NEW Add Varchar::getSize()
This commit is contained in:
commit
1db0156832
@ -32,6 +32,19 @@ class Varchar extends StringField {
|
||||
parent::__construct($name, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow the ability to access the size of the field programatically. This
|
||||
* can be useful if you want to have text fields with a length limit that
|
||||
* is dictated by the DB field.
|
||||
*
|
||||
* TextField::create('Title')->setMaxLength(singleton('SiteTree')->dbObject('Title')->getSize())
|
||||
*
|
||||
* @return int The size of the field
|
||||
*/
|
||||
public function getSize() {
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
/**
|
||||
* (non-PHPdoc)
|
||||
* @see DBField::requireField()
|
||||
|
Loading…
Reference in New Issue
Block a user