<?php
namespace Moto\Website; use Moto; use Website; use Zend; class ContentTaxonomyPage extends Moto\Website\ContentPage { public function __construct($page = null) { parent::__construct($page); $this->_canonicalUrl = ''; } public function setContentEntity($entity) { parent::setContentEntity($entity); $url = Moto\Util::getValue($entity, 'properties.meta.canonical_url'); if (empty($url)) { $url = Moto\Website\BlogApplication::getAbsoluteUrl($entity); } $this->setCanonicalUrl($url); } public function setTemplateEntity($template) { parent::setTemplateEntity($template); $this->_pageEntity = $template; } public function isTemplate() { return false; } public function getLayoutTemplatePath() { return '@layoutTemplates/default/taxonomy.html.twig'; } public function getTitleValue() { $title = trim((string) Moto\Util::getValue($this->_contentEntity, 'properties.meta.title')); if ($title === '') { $title = $this->_contentEntity->name; } return $title; } public function getSeoHtml() { $properties = $this->_contentEntity->properties; $meta = Moto\Util::getValue($properties, 'meta'); if (is_object($meta) && ($meta->noindex || $meta->nofollow )) { $robots = array($meta->noindex ? 'noindex' : 'index', $meta->nofollow ? 'nofollow' : 'follow'); $meta->robots = implode(', ', $robots); } return $this->_generateSeoHtml($properties); } public function getTemplate() { return $this->_templateEntity; } public function getFullUrl($query = null) { return $this->getContentEntity()->getRelativeUrl($query); } public function getRelativeUrl($query = null) { return $this->getContentEntity()->getRelativeUrl($query); } public function getAbsoluteUrl($query = null) { return $this->getContentEntity()->getRelativeUrl($query); } public function setRenderEngine($engine) { $engine->addGlobal('CurrentTaxonomy', $this->getContentEntity()); return parent::setRenderEngine($engine); } } 