/**
  * @inheritdoc
  */
 public function isValid($data, $field = '', array $extra = [])
 {
     if (is_array($data) && array_key_exists($field, $data)) {
         return $this->isValid($data[$field], $field, $extra);
     }
     return $this->articleRepository->resultExists($data);
 }
Ejemplo n.º 2
0
 /**
  * @param int $id
  * @return array
  */
 public function execute($id)
 {
     if ($this->articleRepository->resultExists((int) $id, $this->date->getCurrentDateTime()) === true) {
         $this->setCacheResponseCacheable($this->config->getSettings(Schema::MODULE_NAME)['cache_lifetime']);
         return ['sidebar_article' => $this->articlesCache->getCache($id)];
     }
 }
Ejemplo n.º 3
0
 /**
  * @param int $id
  *
  * @return array
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($id)
 {
     if ($this->articleRepository->resultExists($id, $this->date->getCurrentDateTime()) === true) {
         $this->setCacheResponseCacheable($this->config->getSettings(Schema::MODULE_NAME)['cache_lifetime']);
         $article = $this->articlesCache->getCache($id);
         $this->breadcrumb->replaceAncestor($article['title'], '', true);
         return ['page' => array_merge($article, $this->pageBreaksHelper->splitTextIntoPages($this->view->fetchStringAsTemplate($article['text']), $this->request->getUriWithoutPages()))];
     }
     throw new Core\Controller\Exception\ResultNotExistsException();
 }
Ejemplo n.º 4
0
 /**
  * @param int $id
  *
  * @return bool
  */
 public function articleExists($id)
 {
     return $this->articleRepository->resultExists($id);
 }