Minor improvements in the CMS API
This commit is contained in:
parent
d850a795fd
commit
cc23b434cb
|
|
@ -959,6 +959,17 @@ class Controller extends BaseController
|
|||
return $this->pageObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CMS page object being processed by the controller.
|
||||
* The object is not available on the early stages of the controller
|
||||
* initialization.
|
||||
* @return \Cms\Classes\Page Returns the Page object or null.
|
||||
*/
|
||||
public function getPage()
|
||||
{
|
||||
return $this->page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Intended to be called from the page, returns the layout code base object.
|
||||
* @return \Cms\Classes\CodeBase
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
use URL;
|
||||
use Flash;
|
||||
use Block;
|
||||
use Event;
|
||||
use Twig_Extension;
|
||||
use Twig_TokenParser;
|
||||
use Twig_SimpleFilter;
|
||||
|
|
@ -204,6 +205,9 @@ class Extension extends Twig_Extension
|
|||
return $default;
|
||||
}
|
||||
|
||||
if ($event = Event::fire('cms.block.render', [$name, $result], true))
|
||||
$result = $event;
|
||||
|
||||
$result = str_replace('<!-- X_OCTOBER_DEFAULT_BLOCK_CONTENT -->', trim($default), $result);
|
||||
return $result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue