Skip to content

Commit

Permalink
setup theme: Fixed empty rows + using MicroHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
Laureano Passafaro committed May 5, 2021
1 parent 69519a2 commit a97e574
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions ext/setup/theme.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php declare(strict_types=1);

use function MicroHTML\rawHTML;
use function MicroHTML\TR;
use function MicroHTML\TH;
use function MicroHTML\TD;

class SetupTheme extends Themelet
{
/*
Expand Down Expand Up @@ -107,20 +112,23 @@ protected function build_setup_chunk(string $html): string

protected function build_setup_row(string $html): string
{
return "<tr>$html</tr>";
return (string)TR(rawHTML($html));
}

protected function build_setup_cell(string $html, bool $is_header=false, bool $full_width=false): string
{
$colspan = ($is_header || $full_width ? 2 : 1);
$attr = ["colspan"=>($is_header || $full_width ? '2' : '1')];
$cell = null;
if ($is_header) {
return $this->build_setup_row("<th colspan='$colspan'>$html</th>");
$cell = TH($attr, rawHTML($html));
} else {
if ($full_width) {
return $this->build_setup_row("<td colspan='$colspan'>$html</td>");
} else {
return "<td colspan='$colspan'>$html</td>";
}
$cell = TD($attr, rawHTML($html));
}

if ($is_header || $full_width) {
return $this->build_setup_row((string)$cell);
} else {
return (string)$cell;
}
}

Expand Down

0 comments on commit a97e574

Please sign in to comment.