Skip to content

Commit

Permalink
Refine mapping overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
gabor-udvari committed May 29, 2015
1 parent 0479508 commit 4249d58
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Bootgenie.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,16 @@ protected function _initialize()
self::addOverride('main/menulinks', 'bootgenie/main_menulinks', 'component');

self::addOverride('publish/showarticle', 'bootgenie/publish_showarticle', 'action');
self::addOverride('publish/specialarticle', 'bootgenie/publish_specialarticle', 'action');
self::addOverride('publish/articledisplay', 'bootgenie/publish_articledisplay', 'component');
self::addOverride('publish/menustriplinks', 'bootgenie/publish_menustriplinks', 'component');
self::addOverride('publish/whatlinkshere', 'bootgenie/publish_whatlinkshere', 'component');
self::addOverride('publish/tools', 'bootgenie/publish_tools', 'component');
self::addOverride('publish/latestArticles', 'bootgenie/publish_latestArticles', 'component');

// Disable for testing
// $this->_enabled = false;
// $this->$debug = true;
// $this->_enabled = false;
$this->debug = true;
}

protected function _addListeners()
Expand Down Expand Up @@ -140,8 +141,9 @@ public function listen_renderTemplate(framework\Event $event)

// set override map for actions
$actionmap = self::getActionOverrideMap();
$template = framework\Context::getResponse()->getTemplate();
foreach( $actionmap as $value){
if ( stripos($event->getParameter('class'), $value['class']) !== FALSE && stripos($event->getParameter('action'), $value['action']) !== FALSE) {
if ( stripos($event->getParameter('class'), $value['class']) !== FALSE && stripos($template, $value['action']) !== FALSE) {
framework\Context::getResponse()->setTemplate($value['template']);
}
}
Expand Down
23 changes: 23 additions & 0 deletions templates/publish_specialarticle.html.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

include_component('publish/wikibreadcrumbs', array('article_name' => $article_name));
\thebuggenie\core\framework\Context::loadLibrary('publish/publish');
$tbg_response->setTitle($article_name);

?>

<div class="main-wrapper">
<aside class="sidebar">
<?php include_component('leftmenu', compact('article', 'special')); ?>
</aside>

<section class="main article">
<a name="top"></a>
<?php if ($component): ?>
<?php include_component("publish/special{$component}", compact('projectnamespace')); ?>
<?php else: ?>
<div class="redbox" style="margin: 15px;">
<?php echo __('This special page does not exist'); ?>
</div>
<?php endif; ?>
</section>

0 comments on commit 4249d58

Please sign in to comment.