mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 11:05:32 +02:00
Set "title field" at a meaningful point in TagField instantiation
* Switch diet to dogfood
This commit is contained in:
parent
7a286d432d
commit
1e40d07a98
@ -65,6 +65,7 @@ class TagField extends DropdownField
|
||||
* @param string $title
|
||||
* @param null|DataList $source
|
||||
* @param null|DataList $value
|
||||
* @param string $titleField
|
||||
*/
|
||||
public function __construct($name, $title = '', $source = [], $value = null, $titleField = 'Title')
|
||||
{
|
||||
@ -255,10 +256,10 @@ class TagField extends DropdownField
|
||||
}
|
||||
|
||||
if (is_array($values)) {
|
||||
$values = DataList::create($dataClass)->filter($this->titleField, $values);
|
||||
$values = DataList::create($dataClass)->filter($this->getTitleField(), $values);
|
||||
}
|
||||
|
||||
$ids = $values->column($this->titleField);
|
||||
$ids = $values->column($this->getTitleField());
|
||||
|
||||
$titleField = $this->getTitleField();
|
||||
|
||||
@ -284,10 +285,10 @@ class TagField extends DropdownField
|
||||
$name = $this->getName();
|
||||
|
||||
if ($source->hasMethod($name)) {
|
||||
$value = $source->$name()->column($this->titleField);
|
||||
$value = $source->$name()->column($this->getTitleField());
|
||||
}
|
||||
} elseif ($value instanceof SS_List) {
|
||||
$value = $value->column($this->titleField);
|
||||
$value = $value->column($this->getTitleField());
|
||||
}
|
||||
|
||||
if (!is_array($value)) {
|
||||
|
Loading…
Reference in New Issue
Block a user