html_writer_support
class html_writer_support
| internal |
Utility functions for generating HTML output.
Methods
Generates a full HTML tag.
Generates an opening HTML tag.
Generates a closing HTML tag.
Generates an empty (self-closing) HTML tag.
Generates a non-empty HTML tag, even if contents are empty.
Generates a single HTML attribute.
Generates multiple HTML attributes.
Generates an HTML img tag.
Generates a random unique ID.
Generates an HTML anchor (link) tag.
Generates an HTML checkbox input.
Generates a yes/no select box.
Generates an HTML select box.
Generates date/time selection boxes.
Generates an HTML list (ul/ol).
Generates hidden input tags for URL parameters.
Generates an HTML script tag.
Generates an HTML table.
Generates an HTML label tag.
Generates an HTML div tag.
Generates an opening HTML div tag.
Generates a closing HTML div tag.
Generates an HTML span tag.
Generates an opening HTML span tag.
Generates a closing HTML span tag.
Converts HTML content to plain text.
Details
at line 40
static string
tag(string $tagname, string $contents, array|null $attributes = null)
Generates a full HTML tag.
at line 53
static string
start_tag(string $tagname, array|null $attributes = null)
Generates an opening HTML tag.
at line 65
static string
end_tag(string $tagname)
Generates a closing HTML tag.
at line 78
static string
empty_tag(string $tagname, array|null $attributes = null)
Generates an empty (self-closing) HTML tag.
at line 92
static string
nonempty_tag(string $tagname, mixed $contents, array|null $attributes = null)
Generates a non-empty HTML tag, even if contents are empty.
at line 105
static string
attribute(string $name, mixed $value)
Generates a single HTML attribute.
at line 117
static string
attributes(array|null $attributes = null)
Generates multiple HTML attributes.
at line 131
static string
img(moodle_url|string $src, string $alt, array|null $attributes = null)
Generates an HTML img tag.
at line 143
static string
random_id(string $base = 'random')
Generates a random unique ID.
at line 157
static string
link(moodle_url|string $url, string $text, array|null $attributes = null)
Generates an HTML anchor (link) tag.
at line 174
static string
checkbox(string $name, string $value, bool $checked = true, string $label = '', array|null $attributes = null, array|null $labelattributes = null)
Generates an HTML checkbox input.
at line 194
static string
select_yes_no(string $name, bool $selected = true, array|null $attributes = null)
Generates a yes/no select box.
at line 211
static string
select(array $options, string $name, array|string $selected = '', array $nothing = ['' => 'choosedots'], array|null $attributes = null, array $disabled = [])
Generates an HTML select box.
at line 234
static string
select_time(string $type, string $name, int $currenttime = 0, int $step = 5, array|null $attributes = null, float|int $timezone = 99)
Generates date/time selection boxes.
at line 254
static string
alist(array $items, array|null $attributes = null, string $tag = 'ul')
Generates an HTML list (ul/ol).
at line 267
static string
input_hidden_params(moodle_url $url, array|null $exclude = null)
Generates hidden input tags for URL parameters.
at line 280
static string
script(string $jscode, null|moodle_url|string $url = null)
Generates an HTML script tag.
at line 292
static string
table(html_table $table)
Generates an HTML table.
at line 307
static string
label(string $text, string|null $for, bool $colonize = true, array $attributes = [])
Generates an HTML label tag.
at line 321
static string
div(string $content, string $class = '', array|null $attributes = null)
Generates an HTML div tag.
at line 334
static string
start_div(string $class = '', array|null $attributes = null)
Generates an opening HTML div tag.
at line 344
static string
end_div()
Generates a closing HTML div tag.
at line 358
static string
span(string $content, string $class = '', array|null $attributes = null)
Generates an HTML span tag.
at line 371
static string
start_span(string $class = '', array|null $attributes = null)
Generates an opening HTML span tag.
at line 381
static string
end_span()
Generates a closing HTML span tag.
at line 393
static string
html_to_text(string $html)
Converts HTML content to plain text.