Skip to content

Commit

Permalink
#530 - Allow to defined attributes for BODY element.
Browse files Browse the repository at this point in the history
  • Loading branch information
maraf committed Feb 1, 2024
1 parent 5d55f4a commit 773dccb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/scripts/php/libs/Web.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Web extends BaseTagLib {
private $PageTailScripts = "";
private $PageStyles = "";
private $HtmlAttributes = [];
private $BodyAttributes = [];

public function getPageHeadScripts() {
return $this->PageHeadScripts;
Expand Down Expand Up @@ -1337,6 +1338,7 @@ public function flushContent($lang = null, $keywords = null, $webRootUrl = null)
}

if ($isHtml) {
$bodyAttributes = parent::joinAttributes($this->BodyAttributes);
$return = ''
. $doctype
. '<head>'
Expand All @@ -1349,7 +1351,7 @@ public function flushContent($lang = null, $keywords = null, $webRootUrl = null)
. '<title>' . $this->PageTitle . '</title>'
. $this->PageHead . $this->PageStyles . $this->PageHeadScripts
. '</head>'
. '<body>'
. '<body' . $bodyAttributes . '>'
. $this->PageContent
. $diacont
. $this->PageTailScripts
Expand Down Expand Up @@ -2868,7 +2870,7 @@ public function getDoctype() {
return $this->Doctype;
}

public function setFlushOptions($template = PhpRuntime::UnusedAttributeValue, $contentType = PhpRuntime::UnusedAttributeValue, $isZipEnabled = PhpRuntime::UnusedAttributeValue, $statusCode = PhpRuntime::UnusedAttributeValue, $html = []) {
public function setFlushOptions($template = PhpRuntime::UnusedAttributeValue, $contentType = PhpRuntime::UnusedAttributeValue, $isZipEnabled = PhpRuntime::UnusedAttributeValue, $statusCode = PhpRuntime::UnusedAttributeValue, $html = [], $body = []) {
if ($template !== PhpRuntime::UnusedAttributeValue) {
if ($template == 'null') {
$this->Template = null;
Expand All @@ -2892,6 +2894,7 @@ public function setFlushOptions($template = PhpRuntime::UnusedAttributeValue, $c
}

$this->HtmlAttributes = array_merge($this->HtmlAttributes, $html);
$this->BodyAttributes = array_merge($this->BodyAttributes, $body);
}

public function getFavicon($url, $contentType) {
Expand Down
5 changes: 5 additions & 0 deletions src/app/scripts/php/libs/Web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,11 @@
<prefix />
<comment>Attributy předané kořenovému HTML elementu.</comment>
</attribute>
<attribute>
<name>body</name>
<prefix />
<comment>Attributy předané BODY elementu.</comment>
</attribute>
<comment>
Nastaví vlastnosti výstupu.
</comment>
Expand Down

0 comments on commit 773dccb

Please sign in to comment.