/** * @inheritDoc IElementType::onAfterMoveElementInStructure() * * @param BaseElementModel $element * @param int $structureId * * @return null|void */ public function onAfterMoveElementInStructure(BaseElementModel $element, $structureId) { // Was the entry moved within its section's structure? $section = $element->getSection(); if ($section->type == SectionType::Structure && $section->structureId == $structureId) { craft()->elements->updateElementSlugAndUri($element, true, true, true); } }
/** * Routes the request when the URI matches an element. * * @param BaseElementModel * @return mixed Can be false if no special action should be taken, * a string if it should route to a template path, * or an array that can specify a controller action path, params, etc. */ public function routeRequestForMatchedElement(BaseElementModel $element) { // Make sure that the entry is actually live if ($element->getStatus() == EntryModel::LIVE) { $section = $element->getSection(); // Make sure the section is set to have URLs and is enabled for this locale if ($section->hasUrls && array_key_exists(craft()->language, $section->getLocales())) { return array('action' => 'templates/render', 'params' => array('template' => $section->template, 'variables' => array('entry' => $element))); } } return false; }