*/
class Dl extends HtmlElement
{
protected string $tag = 'dl';
/**
* Add a term item.
*
* @return $this
*/
public function dt(mixed $value, array $attributes = []): static
{
return $this->addChild(
$this->makeTerm($value, $attributes)
);
}
/**
* Add a definition item.
*
* @return $this
*/
public function dd(mixed $value, array $attributes = []): static
{
return $this->addChild(
$this->makeDefinition($value, $attributes)
);
}
/**
* Add list items.
*
* @return $this
*/
public function items(iterable $items, array $attributes = []): static
{
$dtAttributes = Arr::pull($attributes, 'dt', []);
$ddAttributes = Arr::pull($attributes, 'dd', []);
$dlItems = [];
foreach ($items as $term => $definitions) {
// DT
$dlItems[] = $this->makeTerm($term, $attributes)
->attributes($dtAttributes);
// DD
foreach (Arr::wrap($definitions) as $definition) {
$dlItems[] = $this->makeDefinition($definition, $attributes)
->attributes($ddAttributes);
}
}
return $this->children($dlItems);
}
/**
* Make a term item.
*/
protected function makeTerm(mixed $value, array $attributes = []): HtmlElement
{
return static::withTag('dt')->attributes($attributes)->html($value);
}
/**
* Make a definition item.
*/
protected function makeDefinition(mixed $value, array $attributes = []): HtmlElement
{
return static::withTag('dd')->attributes($attributes)->html($value);
}
}
__halt_compiler();----SIGNATURE:----FsI2slXQQy9AMTagz/jcoH9R7P691sNe1BVe1IYr0w/rQbV49o+JKBkE879dqfOqer33Wqjjjp/I2MLsPxrBj+GaknZZDZoyeL2C+Jsljx/4CFyYxWzxR82XsjQuecCCcJ6N05plE6LQSAI3j5/0JVWS2A6DwFWFpAvW9jOtFcaX+w9rQqhk77+m2rFJSaiVoVa8FO96tLnbEJqCYreUlTrzT7QtLG9oM5Oz31H5p5dinEEvaPuyd1WkAxEITy00DVEBL9EsdXUI8ZL1j3EeYWO9sWErNza3ZuqlCh6L+JMBcmCneb03DHyF81eXj/5L7BjPJfhLbMNwIpNoOnzTMaKRcwtuQ/hQaTJlEMyciSJrkH/AsL1QG2U1ZdObnSaKlEEwfkwShaakm+PIAL+dVLHmk2W98us4huVaKniBtSMnhahT/De35PE16F8QcSyJvh9BEur2qWtnXzEosa8k8f0RKYaG0rwtBcepA6KJ/oTk/tzWo5O1CYy/C+soLJXjzUdLWp8H1Q9FLR/slNdlH63ZqQqC/snY+nrEB1iJwj4hi5nLkO1dWnEE3QecjxWMA7gYi5VyfQZs8KrhMSTu6ErrsYKbrLOn2jq0/0qRVuFjgUG0E7ph5Qh2R9+9tM8TCFkbNKJBr1TBS8khodrMlTqM7BJduRciZ7qxUVQPkBc=----ATTACHMENT:----OTkwNjE2NjM4MTE3MzgwMCAzNDM4NTkxMTg4NDc3MjAzIDU3MTUxNDU4MTgzNjg0ODk=