fix: [tagging] error when trying to add a tag that doesn't exist yet
- add default colour to circumvent the errorpull/92/head
parent
caf48c9060
commit
95cb4536e1
|
@ -114,7 +114,6 @@ class TagBehavior extends Behavior
|
||||||
$property = $this->getConfig('tagsAssoc.propertyName');
|
$property = $this->getConfig('tagsAssoc.propertyName');
|
||||||
$options['accessibleFields'][$property] = true;
|
$options['accessibleFields'][$property] = true;
|
||||||
$options['associated']['Tags']['accessibleFields']['id'] = true;
|
$options['associated']['Tags']['accessibleFields']['id'] = true;
|
||||||
|
|
||||||
if (isset($data['tags'])) {
|
if (isset($data['tags'])) {
|
||||||
if (!empty($data['tags'])) {
|
if (!empty($data['tags'])) {
|
||||||
$data[$property] = $this->normalizeTags($data['tags']);
|
$data[$property] = $this->normalizeTags($data['tags']);
|
||||||
|
@ -131,7 +130,6 @@ class TagBehavior extends Behavior
|
||||||
if (!$tag->isNew()) {
|
if (!$tag->isNew()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$existingTag = $this->getExistingTag($tag->name);
|
$existingTag = $this->getExistingTag($tag->name);
|
||||||
if (!$existingTag) {
|
if (!$existingTag) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -176,15 +174,14 @@ class TagBehavior extends Behavior
|
||||||
$result[] = array_merge($common, ['id' => $existingTag->id]);
|
$result[] = array_merge($common, ['id' => $existingTag->id]);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result[] = array_merge(
|
$result[] = array_merge(
|
||||||
$common,
|
$common,
|
||||||
[
|
[
|
||||||
'name' => $tagIdentifier,
|
'name' => $tagIdentifier,
|
||||||
|
'colour' => '#924da6'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue