/** * getChapterHandleGrid * * @param Reference $reference * @return array (2-D) of reference handle, ready for use in routes. */ public function getChapterHandleGrid(Reference $reference, $width = 10) { if ($quadruple = $reference->getFirstQuadruple()) { list($b, $s, $c, $v) = $quadruple; $chapters = $this->getChapters($b); $handles = []; foreach (range(1, $chapters) as $c) { $r = $this->createReferenceFromBookAndChapter($b, $c); $handles[] = $this->getHandle($r); } return array_chunk($handles, $width); } return []; }