Add last() function to ItemInterface/ItemList

Created on 30 January 2024, 7 months ago
Updated 2 February 2024, 7 months ago

Problem/Motivation

There is a first() method in Drupal/Core/TypedData/Plugin/DataType/ItemList.php but no last(), which seem to be a pretty standard and easy method to implement.

Proposed resolution

Something like:

public function last() {
  return $this->get($this->count() - 1);
}

Remaining tasks

  • Add new method
  • Write Test coverage
  • Write Documentation
  • Write Release note
โœจ Feature request
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Typed dataย  โ†’

Last updated 2 days ago

  • Maintained by
  • ๐Ÿ‡ฆ๐Ÿ‡นAustria @fago
Created by

๐Ÿ‡ฉ๐Ÿ‡ฐDenmark NicklasMF

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024