setTitle(Help::langAdmin('Help / Categories List')); $this->setKey('help.category'); $this->withSeoSettings('listing-category', 'help'); $this->setTemplate('list.category', 'help'); } public function handle($keyword) { $this->categoryKeyword = trim($keyword, ' /'); } public function data() { $data = Help::model()->categoryView($this->categoryKeyword); if (empty($data)) { return $this->errors->error404(); } $data = array_merge(parent::data(), $data); # category title => h1 $this->titleh1 = $data['title']; # questions and subcats if (! empty($data['questions_list'])) { foreach ($data['questions_list'] as &$question) { $question['link'] = Url::dynamic($question['link']); } unset($question); } else { if (! empty($data['subcats_list'])) { foreach ($data['subcats_list'] as &$subcat) { $subcat['link'] = Help::url('cat', ['keyword' => $subcat['keyword']]); } unset($subcat); } } $this->breadcrumbs->fill($data['crumbs'], function ($crumb) { return [ 'title' => $crumb['title'], 'link' => Help::url('cat', ['keyword' => $crumb['keyword']]), ]; }); return $data; } public function seo() { $this->request->urlCorrection(Help::url('cat', ['keyword' => $this->categoryKeyword])); $this->seo->canonicalUrl(Help::url('cat', ['keyword' => $this->categoryKeyword], true)); $metaCategories = []; foreach ($this->data['crumbs'] as $crumb) { $metaCategories[] = $crumb['title']; } $this->seo->with([ 'category' => $this->data['title'], 'categories' => join(', ', $metaCategories), 'categories.reverse' => join(', ', array_reverse($metaCategories, true)), ]); $this->seoApply(); } public function seoSettings() { $this->seo ->placeholders([ 'category' => Help::langAdmin('Name of the category (current)'), 'categories' => Help::langAdmin('Title of all categories'), 'categories.reverse' => Help::langAdmin('Title of all categories
(reverse order)'), ]) ->inheritance(); } }