mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
fix error when field definition has changed
This commit is contained in:
parent
7568eb9eda
commit
4182c53304
5
CHANGELOG.md
Normal file
5
CHANGELOG.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Master branch
|
||||||
|
=============
|
||||||
|
|
||||||
|
- fix error on export: error when field definition has changed
|
||||||
|
|
@ -361,6 +361,16 @@ class CustomFieldChoice extends AbstractCustomField
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the choice given in $choiceSlug is checked inside $data.
|
||||||
|
*
|
||||||
|
* Used in list exports.
|
||||||
|
*
|
||||||
|
* @param CustomField $cf
|
||||||
|
* @param string $choiceSlug the slug of the choice we want to know if it was checked
|
||||||
|
* @param array|string $data the data of the field
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function isChecked(CustomField $cf, $choiceSlug, $data)
|
public function isChecked(CustomField $cf, $choiceSlug, $data)
|
||||||
{
|
{
|
||||||
if ($data === null) {
|
if ($data === null) {
|
||||||
@ -369,15 +379,15 @@ class CustomFieldChoice extends AbstractCustomField
|
|||||||
|
|
||||||
if ($cf->getOptions()[self::MULTIPLE]) {
|
if ($cf->getOptions()[self::MULTIPLE]) {
|
||||||
if ($cf->getOptions()[self::ALLOW_OTHER]) {
|
if ($cf->getOptions()[self::ALLOW_OTHER]) {
|
||||||
return \in_array($choiceSlug, $data['_choices']);
|
return \in_array($choiceSlug, $this->deserialize($data, $cf)['_choices']);
|
||||||
} else {
|
} else {
|
||||||
return \in_array($choiceSlug, $data);
|
return \in_array($choiceSlug, $this->deserialize($data, $cf));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($cf->getOptions()[self::ALLOW_OTHER]) {
|
if ($cf->getOptions()[self::ALLOW_OTHER]) {
|
||||||
return $data['_choices'] === $choiceSlug;
|
return $this->deserialize($data, $cf)['_choices'] === $choiceSlug;
|
||||||
} else {
|
} else {
|
||||||
return $data === $choiceSlug;
|
return $this->deserialize($data, $cf) === $choiceSlug;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user