mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 11:05:32 +02:00
TagField lazy load shouldnt render Options
TagField should only render options if the lazy load value isn't set. Options from here come from subsequent POSTs, and rendering the options for every request significantly slows down both the form generation and render.
This commit is contained in:
parent
3797049a31
commit
fa754f3fd3
@ -262,6 +262,20 @@ class TagField extends DropdownField
|
||||
$ids = $values->column($this->getTitleField());
|
||||
|
||||
$titleField = $this->getTitleField();
|
||||
|
||||
if ($this->shouldLazyLoad) {
|
||||
// only render options that are selected as everything else should be lazy loaded, and or loaded by the form
|
||||
foreach ($values as $value) {
|
||||
$options->push(
|
||||
ArrayData::create(array(
|
||||
'Title' => $value->$titleField,
|
||||
'Value' => $value->Title,
|
||||
'Selected' => true, // only values are iterated.
|
||||
))
|
||||
);
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
foreach ($source as $object) {
|
||||
$options->push(
|
||||
|
Loading…
Reference in New Issue
Block a user