Skip to content
Snippets Groups Projects
Commit 10418f1c authored by Owen Bush's avatar Owen Bush
Browse files

Fixing bug with creating events under some circumstances

parent 87006c0a
No related branches found
No related tags found
No related merge requests found
......@@ -148,6 +148,9 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
*/
protected function inheritData() {
$series = $this->getEventSeries();
if ($series === FALSE) {
return [];
}
return $series->{$this->getSourceField()}->getValue() ?? '';
}
......@@ -160,8 +163,12 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
protected function prependData() {
$series = $this->getEventSeries();
$instance = $this->getEventInstance();
$values = [];
if ($series === FALSE) {
return $values;
}
if (!empty($instance->{$this->getEntityField()}->getValue())) {
$values = array_merge($values, $instance->{$this->getEntityField()}->getValue());
}
......@@ -180,8 +187,12 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
protected function appendData() {
$series = $this->getEventSeries();
$instance = $this->getEventInstance();
$values = [];
if ($series === FALSE) {
return $values;
}
if (!empty($series->{$this->getSourceField()}->getValue())) {
$values = array_merge($values, $series->{$this->getSourceField()}->getValue());
}
......@@ -200,9 +211,12 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
protected function fallbackData() {
$series = $this->getEventSeries();
$instance = $this->getEventInstance();
$values = [];
if ($series === FALSE) {
return $values;
}
if (!empty($instance->{$this->getEntityField()}->getValue())) {
$values = $instance->{$this->getEntityField()}->getValue();
}
......@@ -243,11 +257,14 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
/**
* Get the translated eventseries entity.
*
* @return Drupal\Core\Entity\EntityInterface
* The translated eventseries entity.
* @return Drupal\Core\Entity\EntityInterface|bool
* The translated eventseries entity, or FALSE.
*/
protected function getEventSeries() {
$series = $this->entity->getEventSeries();
if (empty($series)) {
return FALSE;
}
if ($series->hasTranslation($this->langCode)) {
return $series->getTranslation($this->langCode);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment