header = $header;
        $this->body = $body;
        $this->section = $section;
        $this->position = $position;
        if (is_null($id)) {
            $id = (empty($header) ? md5($body ?? '') : $header) . $section;
        }
        $str_id = preg_replace('/[^\w-]/', '', str_replace(' ', '_', $id));
        assert(is_string($str_id));
        $this->id = $str_id;
    }
    /**
     * Get the HTML for this block.
     */
    public function get_html(bool $hidable=false): string
    {
        $h = $this->header;
        $b = $this->body;
        $i = $this->id;
        $html = "";
        $h_toggler = $hidable ? " shm-toggler" : "";
        if (!empty($h)) {
            $html .= "$h
";
        }
        if (!empty($b)) {
            $html .= "$b
";
        }
        $html .= "\n";
        return $html;
    }
}
/**
 * Class NavBlock
 *
 * A generic navigation block with a link to the main page.
 *
 * Used because "new NavBlock()" is easier than "new Block('Navigation', ..."
 *
 */
class NavBlock extends Block
{
    public function __construct()
    {
        parent::__construct("Navigation", "Index", "left", 0);
    }
}