bottledcode / swytch-framework

The Smart PHP Framework

Home Page:https://framework.getswytch.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Components should allow children

withinboredom opened this issue · comments

Currently, children of a component are undefined. They should be allowed.

Example component with children:

#[Component('send:label')]
class Label {
  use RegularPhp;

  public function render(string $for): string {
    $this->begin();
    ?>
    <label for="{<?= $for ?>}">
      <children />
    </label>
    <?php
    return $this->end();
  }
}

Then using it:

<send:label for="something">
  these are children
</send:label>

Additionally, using the <children /> tag should be able to be used multiple times with children being duplicated.