Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyvr committed Nov 1, 2024
1 parent dc6df5d commit db90e0b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Blocks/Options/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ abstract class Option
{
public array $attributes = [];

public string $wrapper = '_INJECT_';

public static function make(...$args)
{
return new static(...$args);
}

public function condition($condition)
{
$this->wrapper = '<div x-show="'.($condition).'">_INJECT_</div>';

return $this;
}

public function render()
{
return '';
Expand All @@ -29,6 +38,6 @@ public function makeAttributeString($attributes)

public function __toString()
{
return $this->render();
return str_replace('_INJECT_', $this->render(), $this->wrapper);
}
}

0 comments on commit db90e0b

Please sign in to comment.