decor-6-site/kirby/src/Form/Mixin/Help.php
2026-01-05 19:33:15 +01:00

34 lines
653 B
PHP

<?php
namespace Kirby\Form\Mixin;
/**
* @package Kirby Form
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier
* @license https://opensource.org/licenses/MIT
*/
trait Help
{
/**
* Optional help text below the field
*/
protected string|null $help;
public function help(): string|null
{
if (empty($this->help) === false) {
$help = $this->stringTemplate($this->help);
$help = $this->kirby()->kirbytext($help);
return $help;
}
return null;
}
protected function setHelp(array|string|null $help = null): void
{
$this->help = $this->i18n($help);
}
}