Skip to content
Snippets Groups Projects
Commit 1ee0c849 authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

Attributes

parent fef59eb1
No related branches found
No related tags found
1 merge request!6Feature/attributes
Pipeline #7862 passed
...@@ -205,12 +205,27 @@ class Notice ...@@ -205,12 +205,27 @@ class Notice
return $attribute_string; return $attribute_string;
} }
private function addParagraphToConten()
{
if (0 === strpos($this->noticeContent, '<p>')) {
return false;
}
if (0 === strpos($this->noticeContent, '<div>') || 0 === strpos($this->noticeContent, '<div ')) {
return false;
}
return true;
}
/** /**
* Show notice; * Show notice;
*/ */
public function showNotice() public function showNotice()
{ {
echo sprintf('<div %1$s>%2$s</div>', $this->getAttributesAsString(), $this->noticeContent); $noticeFormat = '<div %1$s>%2$s</div>';
if ($this->addParagraphToConten()) {
$noticeFormat = '<div %1$s><p>%2$s</p></div>';
}
echo sprintf($noticeFormat, $this->getAttributesAsString(), $this->noticeContent);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment