Initial commit
This commit is contained in:
commit
efa5624dab
687 changed files with 162710 additions and 0 deletions
32
kirby/src/Form/Mixin/Label.php
Normal file
32
kirby/src/Form/Mixin/Label.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace Kirby\Form\Mixin;
|
||||
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
/**
|
||||
* @package Kirby Form
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier
|
||||
* @license https://opensource.org/licenses/MIT
|
||||
*/
|
||||
trait Label
|
||||
{
|
||||
/**
|
||||
* The field label can be set as string or associative array with translations
|
||||
*/
|
||||
protected string|null $label;
|
||||
|
||||
public function label(): string|null
|
||||
{
|
||||
return $this->stringTemplate(
|
||||
$this->label ?? Str::ucfirst($this->name())
|
||||
);
|
||||
}
|
||||
|
||||
protected function setLabel(array|string|null $label = null): void
|
||||
{
|
||||
$this->label = $this->i18n($label);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue