/**
  * @param bool $unlinked
  * @return ArrayList
  */
 public function Breadcrumbs($unlinked = false)
 {
     $items = new ArrayList(array(new ArrayData(array('Title' => $this->menu_title(), 'Link' => $unlinked ? false : $this->Link()))));
     $record = $this->currentPage();
     if ($record && $record->exists()) {
         if ($record->hasExtension(Hierarchy::class)) {
             $ancestors = $record->getAncestors();
             $ancestors = new ArrayList(array_reverse($ancestors->toArray()));
             $ancestors->push($record);
             foreach ($ancestors as $ancestor) {
                 $items->push(new ArrayData(array('Title' => $ancestor->MenuTitle ? $ancestor->MenuTitle : $ancestor->Title, 'Link' => $unlinked ? false : Controller::join_links($this->Link('show'), $ancestor->ID))));
             }
         } else {
             $items->push(new ArrayData(array('Title' => $record->MenuTitle ? $record->MenuTitle : $record->Title, 'Link' => $unlinked ? false : Controller::join_links($this->Link('show'), $record->ID))));
         }
     }
     return $items;
 }
 public function testSortSimpleDESCOrder()
 {
     $list = new ArrayList(array(array('Name' => 'Steve'), (object) array('Name' => 'Bob'), array('Name' => 'John')));
     // Sort two arguments
     $list1 = $list->sort('Name', 'DESC');
     $this->assertEquals($list1->toArray(), array(array('Name' => 'Steve'), array('Name' => 'John'), (object) array('Name' => 'Bob')));
     // Sort single string
     $list2 = $list->sort('Name desc');
     $this->assertEquals($list2->toArray(), array(array('Name' => 'Steve'), array('Name' => 'John'), (object) array('Name' => 'Bob')));
     // Sort quoted string
     $list3 = $list->sort('"Name" DESCENDING');
     $this->assertEquals($list3->toArray(), array(array('Name' => 'Steve'), array('Name' => 'John'), (object) array('Name' => 'Bob')));
     // Sort array specifier
     $list4 = $list->sort(array('Name' => 'descending'));
     $this->assertEquals($list4->toArray(), array(array('Name' => 'Steve'), array('Name' => 'John'), (object) array('Name' => 'Bob')));
     // Check original list isn't altered
     $this->assertEquals($list->toArray(), array(array('Name' => 'Steve'), (object) array('Name' => 'Bob'), array('Name' => 'John')));
 }