Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jul 18, 2023
1 parent bac4e7f commit 13e1ac1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Style.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use ipl\Html\Attribute;
use ipl\Html\Attributes;
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlElement;
use ipl\Html\Text;
use ipl\Html\ValidHtml;
Expand Down Expand Up @@ -40,6 +41,18 @@ public function setModule(?string $name): self
return $this;
}

public function addInlineStyleFor(BaseHtmlElement $element, array $properties): self
{
$id = $element->getAttribute('id')->getValue();

if ($id === null) {
$id = uniqid('csp-style', true);
$element->setAttributes(['id' => $id]);
}

return $this->add($id, $properties);
}

public function render(): string
{
if ($this->module !== null) {
Expand Down

0 comments on commit 13e1ac1

Please sign in to comment.