x\panel\to\title()

Normalizes string to a title string.

Table of Contents
  1. Description
  2. Example

Description

x\panel\to\title(?array|string $value, int $level = -1): ?string;

Example

test(x\panel\to\title('<p>This is <b>Bold</b></p>', -2)); // Returns `'<span>This is <b>Bold</b></span>'`
test(x\panel\to\title('<p>This is <b>Bold</b></p>', -1)); // Returns `'<span class="has:title title"><span>This is <b>Bold</b></span></span>'`
test(x\panel\to\title('<p>This is <b>Bold</b></p>', 0)); // Returns `'<p class="has:title level:0 title"><span>This is <b>Bold</b></span></p>'`
test(x\panel\to\title('<p>This is <b>Bold</b></p>', 1)); // Returns `'<h1 class="has:title level:1 title"><span>This is <b>Bold</b></span></h1>'`
test(x\panel\to\title('<p>This is <b>Bold</b></p>', 2)); // Returns `'<h2 class="has:title level:2 title"><span>This is <b>Bold</b></span></h2>'`
test(x\panel\to\title('<p>This is <b>Bold</b></p>', 3)); // Returns `'<h3 class="has:title level:3 title"><span>This is <b>Bold</b></span></h3>'`
test(x\panel\to\title('<p>This is <b>Bold</b></p>', 4)); // Returns `'<h4 class="has:title level:4 title"><span>This is <b>Bold</b></span></h4>'`
test(x\panel\to\title('<p>This is <b>Bold</b></p>', 5)); // Returns `'<h5 class="has:title level:5 title"><span>This is <b>Bold</b></span></h5>'`
test(x\panel\to\title('<p>This is <b>Bold</b></p>', 6)); // Returns `'<h6 class="has:title level:6 title"><span>This is <b>Bold</b></span></h6>'`
test(x\panel\to\title('<p>This is <b>Bold</b></p>', 7)); // Returns `'<span>This is <b>Bold</b></span>'`
$var = '<b>bold</b>';
test(x\panel\to\title(['This is a %s text.', [$var]], 1)); // Returns `'<h1 class="has:title level:1 title">This is a <b>bold</b> text.</h1>'`

x\panel\to\color()

Turns any color string or an array of red, green, blue, and an optional alpha channel into a HEX color string.

x\panel\to\title()

Normalizes string to a title string.