1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-21 22:06:12 +02:00

Fix issue processwire/processwire-issues#302 where markup <region> tags didn't get removed if template file produced no output

This commit is contained in:
Ryan Cramer
2018-02-26 09:58:29 -05:00
parent 9d2a986048
commit ac779c79a8
2 changed files with 10 additions and 5 deletions

View File

@@ -543,6 +543,9 @@ class PageRender extends WireData implements Module, ConfigurableModule {
*
*/
protected function populateMarkupRegions(&$html) {
$markupRegions = new WireMarkupRegions();
$this->wire($markupRegions);
$pos = stripos($html, '<!DOCTYPE html');
@@ -552,14 +555,15 @@ class PageRender extends WireData implements Module, ConfigurableModule {
}
// if no document start, or document starts at pos==0, then nothing to populate
if(!$pos) return;
if(!$pos) {
// there still may be region related stuff that needs to be removed like <region> tags
$markupRegions->removeRegionTags($html);
return;
}
// split document at doctype/html boundary
$htmlBefore = substr($html, 0, $pos);
$html = substr($html, $pos);
$markupRegions = new WireMarkupRegions();
$this->wire($markupRegions);
$options = array('useClassActions' => true);
$config = $this->wire('config');
$version = (int) $config->useMarkupRegions;