/**
  * @inheritdoc
  */
 public function isValid($data, $field = '', array $extra = [])
 {
     if (is_array($data) && is_array($field)) {
         $categoryId = reset($field);
         $createCategory = next($field);
         return !empty($data[$createCategory]) || $this->categoryRepository->resultExists($data[$categoryId]);
     }
     return false;
 }
示例#2
0
 /**
  * @param int $cat
  *
  * @return array
  * @throws \ACP3\Core\Controller\Exception\ResultNotExistsException
  */
 public function execute($cat)
 {
     if ($this->categoryRepository->resultExists($cat) === true) {
         $this->setCacheResponseCacheable($this->config->getSettings(Schema::MODULE_NAME)['cache_lifetime']);
         $category = $this->categoryRepository->getOneById($cat);
         $this->breadcrumb->append($this->translator->t('files', 'files'), 'files')->append($category['title']);
         $settings = $this->config->getSettings(FilesModule\Installer\Schema::MODULE_NAME);
         return ['dateformat' => $settings['dateformat'], 'files' => $this->filesRepository->getAllByCategoryId($cat, $this->date->getCurrentDateTime())];
     }
     throw new Core\Controller\Exception\ResultNotExistsException();
 }