public function getEditItem() { $index = $this->getEditItemIndex(); $items = $this->getItems(); if ($index >= 0 && $index < $items->getCount()) { return $items->itemAt($index); } else { return null; } }