Initial commit
This commit is contained in:
commit
388079e6bb
1108 changed files with 330121 additions and 0 deletions
34
kirby/src/Form/Mixin/Help.php
Normal file
34
kirby/src/Form/Mixin/Help.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue