Skip to content
Snippets Groups Projects
Commit d4c251a7 authored by vlad.dancer's avatar vlad.dancer Committed by Owen Bush
Browse files

Issue #3301390 by vlad.dancer, owenbush: Use isEmpty() method instead checking...

Issue #3301390 by vlad.dancer, owenbush: Use isEmpty() method instead checking output with empty function
parent 60bb4062
Branches
Tags
1 merge request!2Use isEmpty() method instead of empty() function
......@@ -221,21 +221,24 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
/**
* Retrieve inherited data.
*
* @return string
* @return array
* The inherited data.
*/
protected function inheritData() {
$source_entity = $this->getSourceEntity();
if ($source_entity === FALSE) {
if ($source_entity === FALSE
|| $source_entity->{$this->getSourceField()}->isEmpty()
) {
return [];
}
return $source_entity->{$this->getSourceField()}->getValue() ?? '';
return $source_entity->{$this->getSourceField()}->getValue();
}
/**
* Retrieve prepended data.
*
* @return string
* @return array
* The prepended data.
*/
protected function prependData() {
......@@ -247,10 +250,10 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
return $values;
}
if (!empty($destination_entity->{$this->getDestinationField()}->getValue())) {
if (!$destination_entity->{$this->getDestinationField()}->isEmpty()) {
$values = array_merge($values, $destination_entity->{$this->getDestinationField()}->getValue());
}
if (!empty($source_entity->{$this->getSourceField()}->getValue())) {
if (!$source_entity->{$this->getSourceField()}->isEmpty()) {
$values = array_merge($values, $source_entity->{$this->getSourceField()}->getValue());
}
return $values;
......@@ -271,10 +274,10 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
return $values;
}
if (!empty($source_entity->{$this->getSourceField()}->getValue())) {
if (!$source_entity->{$this->getSourceField()}->isEmpty()) {
$values = array_merge($values, $source_entity->{$this->getSourceField()}->getValue());
}
if (!empty($destination_entity->{$this->getDestinationField()}->getValue())) {
if (!$destination_entity->{$this->getDestinationField()}->isEmpty()) {
$values = array_merge($values, $destination_entity->{$this->getDestinationField()}->getValue());
}
return $values;
......@@ -283,7 +286,7 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
/**
* Retrieve fallback data.
*
* @return string
* @return array
* The fallback data.
*/
protected function fallbackData() {
......@@ -295,10 +298,10 @@ abstract class FieldInheritancePluginBase extends PluginBase implements FieldInh
return $values;
}
if (!empty($destination_entity->{$this->getDestinationField()}->getValue())) {
if (!$destination_entity->{$this->getDestinationField()}->isEmpty()) {
$values = $destination_entity->{$this->getDestinationField()}->getValue();
}
elseif (!empty($source_entity->{$this->getSourceField()}->getValue())) {
elseif (!$source_entity->{$this->getSourceField()}->isEmpty()) {
$values = $source_entity->{$this->getSourceField()}->getValue();
}
return $values;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment