Example #1
0
 /**
  * Build a single item within the outline.
  *
  * @param string $id ID of record to retrieve
  *
  * @return array
  */
 protected function buildItem($id)
 {
     // Else, get all the data and save it to the cache
     $list = [];
     // Get the file type
     $file = $this->connector->getDatastreams($id);
     preg_match_all('/dsid="([^"]+)"[^>]*mimeType="([^"]+)/', $file, $list);
     $masterIndex = array_search('MASTER', $list[1]);
     $mimetype = $masterIndex ? $list[2][$masterIndex] : 'N/A';
     if (!$masterIndex) {
         $type = 'page';
     } else {
         $type = substr($list[2][$masterIndex], strpos($list[2][$masterIndex], '/') + 1);
     }
     $details = $this->connector->getDetails($id, false);
     return ['id' => $id, 'fulltype' => $type, 'mimetype' => $mimetype, 'filetype' => isset($this->routes[$type]) ? $this->routes[$type] : $type, 'label' => isset($details['title']) ? $details['title'] : $id, 'datastreams' => $list[1], 'mimetypes' => $list[2]];
 }