mirror of
https://github.com/silverstripe/silverstripe-tagfield
synced 2024-10-22 11:05:32 +02:00
converted tabs to spaces as per psr-2
This commit is contained in:
parent
76c10d8df2
commit
65f6d7531b
@ -231,7 +231,7 @@ class TagField extends DropdownField
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
@ -310,7 +310,7 @@ class TagField extends DropdownField
|
||||
|
||||
$relation->setByIDList(array_filter($ids));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or create tag with the given value
|
||||
@ -321,25 +321,25 @@ class TagField extends DropdownField
|
||||
protected function getOrCreateTag($term)
|
||||
{
|
||||
// Check if existing record can be found
|
||||
$source = $this->getSource();
|
||||
$titleField = $this->getTitleField();
|
||||
$record = $source
|
||||
->filter($titleField, $term)
|
||||
->first();
|
||||
if($record) {
|
||||
return $record;
|
||||
}
|
||||
$source = $this->getSource();
|
||||
$titleField = $this->getTitleField();
|
||||
$record = $source
|
||||
->filter($titleField, $term)
|
||||
->first();
|
||||
if($record) {
|
||||
return $record;
|
||||
}
|
||||
|
||||
// Create new instance if not yet saved
|
||||
if ($this->getCanCreate()) {
|
||||
$dataClass = $source->dataClass();
|
||||
$record = Injector::inst()->create($dataClass);
|
||||
$record->{$titleField} = $term;
|
||||
$record->write();
|
||||
return $record;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// Create new instance if not yet saved
|
||||
if ($this->getCanCreate()) {
|
||||
$dataClass = $source->dataClass();
|
||||
$record = Injector::inst()->create($dataClass);
|
||||
$record->{$titleField} = $term;
|
||||
$record->write();
|
||||
return $record;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user