]> BookStack Code Mirror - bookstack/blobdiff - app/Chapter.php
Page Attachments - Improved UI, Now initially complete
[bookstack] / app / Chapter.php
index 250e323f5246557c4180481fda27392f00e6643b..8f0453172ff17447e9f86eef125cad7d8c12b445 100644 (file)
@@ -25,11 +25,15 @@ class Chapter extends Entity
 
     /**
      * Get the url of this chapter.
+     * @param string|bool $path
      * @return string
      */
-    public function getUrl()
+    public function getUrl($path = false)
     {
         $bookSlug = $this->getAttribute('bookSlug') ? $this->getAttribute('bookSlug') : $this->book->slug;
+        if ($path !== false) {
+            return baseUrl('/books/' . $bookSlug. '/chapter/' . $this->slug . '/' . trim($path, '/'));
+        }
         return baseUrl('/books/' . $bookSlug. '/chapter/' . $this->slug);
     }