/** * AbstractHandler constructor. * * @param Filesystem $filesystem */ public function __construct(Filesystem $filesystem, Factory $viewFactory, Channel $river, $files, $folders) { parent::__construct($filesystem, $viewFactory); $this->river = $river; $this->channel = $river->getChannel(); $this->files = $files; $this->folders = $folders; $this->imageHandler = new ImageHandler($filesystem, $viewFactory); // handle media files $this->handleMediaFiles(); // handle post data $this->handlePostData(); }
/** * BlogPaginationBuilder constructor. * * @param Filesystem $filesystem * @param Factory $viewFactory * @param array $viewsData */ public function __construct(Filesystem $filesystem, Factory $viewFactory, array $viewsData, Channel $river) { $this->filesystem = $filesystem; $this->viewFactory = $viewFactory; $this->viewsData = $viewsData; $this->river = $river; $this->channel = $river->getChannel(); $this->view = $river->getView(); $this->paginationContainer = $river->getPaginationContainer(); $this->postsPerPage = $river->getPostsPerPage() ?: 5; $this->container = $river->getContainer(); $this->paginationView = $river->getPaginationView(); }
/** * @param Channel $river */ private function buildBlogPage(Channel $river) { // get the channel specific files $files = $this->fileHandler->channel($river->getChannel())->files(); $folders = $this->fileHandler->channel($river->getChannel())->folders(); // channelHandler @foreach -> handle channel $blogPostHandler = new BlogPostHandler($this->filesystem, $this->viewFactory, $river, $files, $folders); // add channel to view data $this->viewsData[$river->getContainer()] = $blogPostHandler->getPostBlogData(); // handle and build the channel static files $blogPostHandler->build($this->viewsData); }