示例#1
0
文件: copi.php 项目: amdad/copilot
 /**
  * [pages description]
  * @param  [type] $folder [description]
  * @return [type]         [description]
  */
 public static function pages($folder)
 {
     if (strpos($folder, ':') === false && !self::$app->isAbsolutePath($folder)) {
         $path = "content:{$folder}";
     } else {
         $path = $folder;
     }
     return \Copilot\PageCollection::fromFolder($path);
 }
示例#2
0
文件: Page.php 项目: amdad/copilot
 /**
  * [siblings description]
  * @return [type]
  */
 public function siblings($filter = null)
 {
     if ($this->isIndex()) {
         if ($this->isRootIndex()) {
             $collection = new PageCollection([]);
         } else {
             $collection = PageCollection::fromFolder(dirname($this->dir))->not($this);
         }
     } else {
         $collection = PageCollection::fromFolder($this->dir)->not($this);
         if (!$this->isIndex()) {
             $collection = $collection->not($this->parent());
         }
     }
     // apply filter
     if ($filter && $collection->count()) {
         $collection = $collection->filter($filter);
     }
     return $collection;
 }