Added getSource() function to populate source inline with the api.

Source isn't populated to the parent because it's transformed directly
to an array. Instead we're lazy loading the source when it's requested.
This commit is contained in:
Simon Gow 2018-09-13 11:18:55 +12:00
parent fa754f3fd3
commit 024e648e5a

View File

@ -312,6 +312,21 @@ class TagField extends DropdownField
return parent::setValue(array_filter($value));
}
/**
* Gets the source array if required
*
* Note: this is expensive for a SS_List
*
* @return array
*/
public function getSource()
{
if (is_null($this->source)) {
$this->setSource($this->getSourceList());
}
return $this->source;
}
/**
* {@inheritdoc}
*/