Skip to content

Commit

Permalink
FIX Stop calling deprecated method in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jan 10, 2025
1 parent 3f5b363 commit 94af2e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/View/SSTemplateParser.peg
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,9 @@ class SSTemplateParser extends Parser implements TemplateParser
if ($res['ArgumentCount'] != 0) {
throw new SSTemplateParseException('Base_tag takes no arguments', $this);
}
return '$val .= \\SilverStripe\\View\\SSViewer::get_base_tag($val);';
$code = '$isXhtml = preg_match(\'/<!DOCTYPE[^>]+xhtml/i\', $val);';
$code .= PHP_EOL . '$val .= \\SilverStripe\\View\\SSViewer::getBaseTag($isXhtml);';
return $code;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/View/SSTemplateParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4440,7 +4440,9 @@ function OpenBlock_Handle_Base_tag(&$res)
if ($res['ArgumentCount'] != 0) {
throw new SSTemplateParseException('Base_tag takes no arguments', $this);
}
return '$val .= \\SilverStripe\\View\\SSViewer::get_base_tag($val);';
$code = '$isXhtml = preg_match(\'/<!DOCTYPE[^>]+xhtml/i\', $val);';
$code .= PHP_EOL . '$val .= \\SilverStripe\\View\\SSViewer::getBaseTag($isXhtml);';
return $code;
}

/**
Expand Down

0 comments on commit 94af2e5

Please sign in to comment.