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

Merge branch 'create-event-bug' into '8.x-1.x'

Fixing bug with creating events under some circumstances

See merge request proj/contrib/recurring_events!3
parents 87006c0a 10418f1c
No related branches found
No related tags found
No related merge requests found
...@@ -148,6 +148,9 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh ...@@ -148,6 +148,9 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
*/ */
protected function inheritData() { protected function inheritData() {
$series = $this->getEventSeries(); $series = $this->getEventSeries();
if ($series === FALSE) {
return [];
}
return $series->{$this->getSourceField()}->getValue() ?? ''; return $series->{$this->getSourceField()}->getValue() ?? '';
} }
...@@ -160,8 +163,12 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh ...@@ -160,8 +163,12 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
protected function prependData() { protected function prependData() {
$series = $this->getEventSeries(); $series = $this->getEventSeries();
$instance = $this->getEventInstance(); $instance = $this->getEventInstance();
$values = []; $values = [];
if ($series === FALSE) {
return $values;
}
if (!empty($instance->{$this->getEntityField()}->getValue())) { if (!empty($instance->{$this->getEntityField()}->getValue())) {
$values = array_merge($values, $instance->{$this->getEntityField()}->getValue()); $values = array_merge($values, $instance->{$this->getEntityField()}->getValue());
} }
...@@ -180,8 +187,12 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh ...@@ -180,8 +187,12 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
protected function appendData() { protected function appendData() {
$series = $this->getEventSeries(); $series = $this->getEventSeries();
$instance = $this->getEventInstance(); $instance = $this->getEventInstance();
$values = []; $values = [];
if ($series === FALSE) {
return $values;
}
if (!empty($series->{$this->getSourceField()}->getValue())) { if (!empty($series->{$this->getSourceField()}->getValue())) {
$values = array_merge($values, $series->{$this->getSourceField()}->getValue()); $values = array_merge($values, $series->{$this->getSourceField()}->getValue());
} }
...@@ -200,9 +211,12 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh ...@@ -200,9 +211,12 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
protected function fallbackData() { protected function fallbackData() {
$series = $this->getEventSeries(); $series = $this->getEventSeries();
$instance = $this->getEventInstance(); $instance = $this->getEventInstance();
$values = []; $values = [];
if ($series === FALSE) {
return $values;
}
if (!empty($instance->{$this->getEntityField()}->getValue())) { if (!empty($instance->{$this->getEntityField()}->getValue())) {
$values = $instance->{$this->getEntityField()}->getValue(); $values = $instance->{$this->getEntityField()}->getValue();
} }
...@@ -243,11 +257,14 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh ...@@ -243,11 +257,14 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
/** /**
* Get the translated eventseries entity. * Get the translated eventseries entity.
* *
* @return Drupal\Core\Entity\EntityInterface * @return Drupal\Core\Entity\EntityInterface|bool
* The translated eventseries entity. * The translated eventseries entity, or FALSE.
*/ */
protected function getEventSeries() { protected function getEventSeries() {
$series = $this->entity->getEventSeries(); $series = $this->entity->getEventSeries();
if (empty($series)) {
return FALSE;
}
if ($series->hasTranslation($this->langCode)) { if ($series->hasTranslation($this->langCode)) {
return $series->getTranslation($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