60 lines
1.2 KiB
Plaintext
60 lines
1.2 KiB
Plaintext
/**
|
|
* Constructor.
|
|
*
|
|
* @since 3.2.0
|
|
*/
|
|
public function __construct()
|
|
{
|
|
$this->setSeparator('|');
|
|
}
|
|
|
|
/**
|
|
* Get the build component content
|
|
*
|
|
* @return string
|
|
* @since 3.2.0
|
|
*/
|
|
public function build(): string
|
|
{
|
|
if ($this->isActive())
|
|
{
|
|
$bucket = ['<section name="component">'];
|
|
|
|
// get the header
|
|
if ($this->exists('->HEAD<-'))
|
|
{
|
|
$headers = $this->get('->HEAD<-');
|
|
|
|
// remove from active values
|
|
$this->remove('->HEAD<-');
|
|
|
|
foreach ($headers as $action)
|
|
{
|
|
$bucket[] = Indent::_(2) . '<action name="'
|
|
. $action['name'] . '" title="'
|
|
. $action['title'] . '" description="'
|
|
. $action['description'] . '" />';
|
|
}
|
|
}
|
|
|
|
if ($this->isActive())
|
|
{
|
|
ksort($this->active, SORT_STRING);
|
|
|
|
foreach ($this->active as $active)
|
|
{
|
|
$bucket[] = Indent::_(2) . '<action name="'
|
|
. $active['name'] . '" title="'
|
|
. $active['title'] . '" description="'
|
|
. $active['description'] . '" />';
|
|
}
|
|
}
|
|
|
|
// reset memory
|
|
$this->active = [];
|
|
|
|
return implode(PHP_EOL, $bucket) . PHP_EOL . Indent::_(1) . "</section>";
|
|
}
|
|
|
|
return '';
|
|
} |