Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Render option with custom function (#3)
Browse files Browse the repository at this point in the history
* feat(Form): function call to render

* fix(Form): optional label

* chore(Form): renamed fn to render
  • Loading branch information
xTCry authored Oct 23, 2020
1 parent ca65ddc commit 9915bd1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Options/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function write(): void
<?php
switch ($opt['type']) {
case 'html':
if ($opt['label'] !== '') {
if (!empty($opt['label'])) {
?>
<td width="30%" style="vertical-align: top; line-height: 25px;">
<label for="<?= $opt_name ?>">
Expand All @@ -157,6 +157,8 @@ public function write(): void
} else if (file_exists($opt['path'])) {
/** @noinspection PhpIncludeInspection */
include $opt['path'];
} else if (isset($opt['render']) && is_callable($opt['render'])) {
echo $opt['render']();
}
?>
</td>
Expand Down

0 comments on commit 9915bd1

Please sign in to comment.