Example #1
0
 /**
  * @param Book $book
  * @return BookPage[]|null
  */
 function getBookPages(Book $book)
 {
     $files = call_user_func($this->finders['findBookPageFiles'], $book->getPath() . '/pages');
     $result = new NamedList();
     foreach ($files as $file) {
         $page = new BookPage($this->project, $book, $file, true);
         if ($page->isLoaded()) {
             $result->add($page->getShortName(), $page);
         }
     }
     return $result;
 }
Example #2
0
 /**
  * @param Project         $project
  * @param Book            $book
  * @param string          $target_path
  * @param string          $locale
  * @param OutputInterface $output
  */
 private function copyBookImages(Project $project, Book $book, $target_path, $locale, OutputInterface $output)
 {
     $book_path = $book->getPath();
     $book_name = $book->getShortName();
     if (is_dir("{$book_path}/images")) {
         $book_images_path = $locale === $project->getDefaultLocale() ? "{$target_path}/assets/images/books/{$book_name}" : "{$target_path}/assets/images/{$locale}/books/{$book_name}";
         Shade::copyDir("{$book_path}/images", $book_images_path, null, function ($path) use(&$output) {
             $output->writeln("{$path} copied");
         });
     }
 }
Example #3
0
 /**
  * Return book page URL
  *
  * @param string $book_name
  * @param string $page_slug
  * @return string
  */
 private static function getBookPageUrl($book_name, $page_slug)
 {
     return self::pageLevelToPrefix(self::$current_element->getPageLevel()) . 'books/' . $book_name . '/' . $page_slug . '.html';
 }
Example #4
0
 /**
  * Construct and load help element
  *
  * @param string      $module
  * @param Book|string $book
  * @param string      $path
  * @param bool        $load
  */
 public function __construct($module, $book, $path, $load = true)
 {
     $this->book_name = $book instanceof Book ? $book->getShortName() : $book;
     parent::__construct($module, $path, $load);
 }