Skip to content

Commit

Permalink
Merge pull request #68 from Schrank/master
Browse files Browse the repository at this point in the history
Fixes #67
  • Loading branch information
tobi-pb authored Sep 18, 2017
2 parents d8aa05b + 6755d7e commit 46d0e81
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Webguys_Easytemplate_Block_Input_Renderer_Reference extends Webguys_Easytemplate_Block_Input_Renderer_Abstract
{
public function __construct(array $args = array())
public function __construct(array $args = [])
{
parent::__construct($args);
$this->setTemplate('easytemplate/input/renderer/reference.phtml');
Expand Down Expand Up @@ -47,6 +47,15 @@ public function getReferenceLabel()
public function getReferenceDefaultName()
{
$configModel = Mage::getSingleton('easytemplate/input_parser');
if (!$configModel->getTemplate($this->getReference())) {
Mage::getSingleton('core/session')->addError(
$this->__('Template with reference name "%s" not found.', $this->getReference())
);
$ex = new Webguys_Easytemplate_Exception_RedirectException();
$ex->prepareRedirect('adminhtml/cms_page');
throw $ex;

}
return $configModel->getTemplate($this->getReference())->getLabel();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

class Webguys_Easytemplate_Exception_RedirectException extends Mage_Core_Controller_Varien_Exception
{
public function prepareRedirect($path, $arguments = [])
{
$this->_resultCallback = self::RESULT_REDIRECT;
$this->_resultCallbackParams = [$path, $arguments];
return $this;
}
}

0 comments on commit 46d0e81

Please sign in to comment.