public function setNextItem(ProxySourceItem $item = null) { $lastNextItem = $this->nextItem; $this->nextItem = $item; if ($lastNextItem) { // We did have a item before... if (!$item || $item->id() !== $lastNextItem->id()) { // But we no longer have a item or the item we // were given does not have the same ID as the // last one we had... $this->reprocess(); } } elseif ($item) { // We didn't have a item before but we do now... $this->reprocess(); } }
public function sort(ProxySourceItem $a, ProxySourceItem $b) { if ($a->date() && $a->title() && $b->date() && $b->title()) { return strnatcmp($b->date() . ' ' . $b->title(), $a->date() . ' ' . $a->title()); } return strnatcmp($a->relativePathname(), $b->relativePathname()); }
public function setNextItem(ProxySourceItem $item = null) { parent::setNextItem($item); // expose additional metadata $this->data()->set('next_project', $item); }