diff --git a/core/modules/views/src/Plugin/views/field/EntityField.php b/core/modules/views/src/Plugin/views/field/EntityField.php index 2c1d76ce444ec2a811ecfee6f3dd23bb0ee9a5e1..fe2f28da8067f558e610fee3e4956d0c42b144c5 100644 --- a/core/modules/views/src/Plugin/views/field/EntityField.php +++ b/core/modules/views/src/Plugin/views/field/EntityField.php @@ -754,7 +754,7 @@ protected function prepareItemsByDelta(array $all_values) { $offset = 0; } else { - $delta_limit = $this->options['delta_limit']; + $delta_limit = (int) $this->options['delta_limit']; $offset = intval($this->options['delta_offset']); // We should only get here in this case if there is an offset, and in diff --git a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php index f3549c4621f888de36f48ceaab6d19b53eb2dfd7..c60e91447f0fc1ae6a14fc5a4c0306ce5f13fefd 100644 --- a/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php +++ b/core/modules/views/tests/src/Unit/Plugin/field/FieldTest.php @@ -649,6 +649,11 @@ public function providerTestPrepareItemsByDelta() { $data[] = [['group_rows' => TRUE, 'delta_limit' => 1, 'delta_first_last' => TRUE], [3]]; $data[] = [['group_rows' => TRUE, 'delta_offset' => 1, 'delta_first_last' => TRUE], [1, 9]]; + // Test with string values where we would expect integers to be provided. + $data[] = [['group_rows' => TRUE, 'delta_limit' => 'All'], [3, 1, 4, 1, 5, 9]]; + $data[] = [['group_rows' => TRUE, 'delta_limit' => 'three'], [3, 1, 4, 1, 5, 9]]; + $data[] = [['group_rows' => TRUE, 'delta_limit' => 'three', 'delta_offset' => 'two'], [3, 1, 4, 1, 5, 9]]; + return $data; }