Commit dc4327ba authored by webchick's avatar webchick

Issue #2141539 by yched, JStanton, InternetDevels, blesss: Rename...

Issue #2141539 by yched, JStanton, InternetDevels, blesss: Rename FieldItemListInterface::filterEmptyValues() to filterEmptyItems().
parent 310c6159
......@@ -802,9 +802,9 @@ public function updateOriginalValues() {
}
foreach ($this->getPropertyDefinitions() as $name => $definition) {
if (!$definition->isComputed() && !empty($this->fields[$name])) {
foreach ($this->fields[$name] as $langcode => $field) {
$field->filterEmptyValues();
$this->values[$name][$langcode] = $field->getValue();
foreach ($this->fields[$name] as $langcode => $item) {
$item->filterEmptyItems();
$this->values[$name][$langcode] = $item->getValue();
}
}
}
......
......@@ -891,7 +891,7 @@ protected function doSaveFieldItems(EntityInterface $entity, $update) {
foreach ($langcodes as $langcode) {
$delta_count = 0;
$items = $entity->getTranslation($langcode)->get($field_name);
$items->filterEmptyValues();
$items->filterEmptyItems();
foreach ($items as $delta => $item) {
// We now know we have someting to insert.
$do_insert = TRUE;
......
......@@ -81,7 +81,7 @@ public function getFieldDefinition() {
/**
* {@inheritdoc}
*/
public function filterEmptyValues() {
public function filterEmptyItems() {
if (isset($this->list)) {
$this->list = array_values(array_filter($this->list, function($item) {
return !$item->isEmpty();
......@@ -238,7 +238,7 @@ protected function getDefaultValue() {
*/
public function preSave() {
// Filter out empty items.
$this->filterEmptyValues();
$this->filterEmptyItems();
$this->delegateMethod('presave');
}
......
......@@ -74,7 +74,7 @@ public function defaultAccess($operation = 'view', AccountInterface $account = N
/**
* Filters out empty field items and re-numbers the item deltas.
*/
public function filterEmptyValues();
public function filterEmptyItems();
/**
* Gets a property object from the first field item.
......
......@@ -307,7 +307,7 @@ public function extractFormValues(FieldItemListInterface $items, array $form, ar
$this->sortItems($items);
// Remove empty values.
$items->filterEmptyValues();
$items->filterEmptyItems();
// Put delta mapping in $form_state, so that flagErrors() can use it.
$field_state = field_form_get_state($form['#parents'], $field_name, $form_state);
......
......@@ -85,7 +85,7 @@ public function prepareView(array $entities_items) {
// Rekey the items array if needed.
if ($rekey) {
$items->filterEmptyValues();
$items->filterEmptyItems();
}
}
}
......
......@@ -99,7 +99,7 @@ function field_invoke_method($method, $target_function, EntityInterface $entity,
if (method_exists($target, $method)) {
$items = $entity->get($field_definition->getName());
$items->filterEmptyValues();
$items->filterEmptyItems();
$result = $target->$method($items, $a, $b);
......@@ -179,7 +179,7 @@ function field_invoke_method_multiple($method, $target_function, array $entities
// If there is a target, group the field items.
if ($grouped_targets[$group_key]) {
$items = $entity->get($field_name);
$items->filterEmptyValues();
$items->filterEmptyItems();
$grouped_items[$group_key][$id] = $items;
}
}
......
......@@ -56,7 +56,7 @@ function assertFieldValues(EntityInterface $entity, $field_name, $expected_value
$e = entity_load($entity->entityType(), $entity->id());
$field = $values = $e->getTranslation($langcode)->$field_name;
// Filter out empty values so that they don't mess with the assertions.
$field->filterEmptyValues();
$field->filterEmptyItems();
$values = $field->getValue();
$this->assertEqual(count($values), count($expected_values), 'Expected number of values were saved.');
foreach ($expected_values as $key => $value) {
......
......@@ -154,7 +154,7 @@ function assertFieldValues(EntityInterface $entity, $field_name, $expected_value
$e = entity_load($entity->entityType(), $entity->id());
$field = $values = $e->getTranslation($langcode)->$field_name;
// Filter out empty values so that they don't mess with the assertions.
$field->filterEmptyValues();
$field->filterEmptyItems();
$values = $field->getValue();
$this->assertEqual(count($values), count($expected_values), 'Expected number of values were saved.');
foreach ($expected_values as $key => $value) {
......
......@@ -60,7 +60,7 @@ public function prepareView(array $entities_items) {
// Rekey the items array if needed.
if ($rekey) {
$items->filterEmptyValues();
$items->filterEmptyItems();
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment