Commit 89581ca4 authored by mxh's avatar mxh Committed by Jürgen Haas
Browse files

Issue #3261414 by mxh, jurgenhaas, goldin, maerzm: Add or remove a value or...

Issue #3261414 by mxh, jurgenhaas, goldin, maerzm: Add or remove a value or values from a multi-value field
parent 85c1e5e8
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -152,8 +152,12 @@ abstract class FieldUpdateActionBase extends ActionBase implements OptionsInterf

      if (empty($values) && !empty($current_values) && ($this->configuration['method'] === 'set:clear')) {
        // Shorthand for setting a field to be empty.
        $current_values = [];
        $values_changed = TRUE;
        $update_target->setValue([]);
        foreach ($metadata['entities'] as $entity_to_save) {
          if (!in_array($entity_to_save, $all_entities_to_save, TRUE)) {
            $all_entities_to_save[] = $entity_to_save;
          }
        }
        continue;
      }

@@ -183,7 +187,7 @@ abstract class FieldUpdateActionBase extends ActionBase implements OptionsInterf
        }
      }

      if ((reset($method_settings) !== 'remove') && (count($existing) === count($values))) {
      if ((reset($method_settings) !== 'remove') && (count($existing) === count($values)) && (count($existing) === count($current_values))) {
        continue;
      }