julienmonnerie/kirby/config/sections/mixins/headline.php

35 lines
906 B
PHP
Raw Normal View History

2022-06-17 17:51:59 +02:00
<?php
use Kirby\Toolkit\I18n;
return [
'props' => [
/**
* The headline for the section. This can be a simple string or a template with additional info from the parent page.
2022-06-17 18:02:55 +02:00
* @todo deprecate in 3.7
2022-06-17 17:51:59 +02:00
*/
'headline' => function ($headline = null) {
return I18n::translate($headline, $headline);
2022-06-17 18:02:55 +02:00
},
/**
* label is the new official replacement for headline
*/
'label' => function ($label = null) {
return I18n::translate($label, $label);
2022-06-17 17:51:59 +02:00
}
],
'computed' => [
'headline' => function () {
if ($this->headline) {
return $this->model()->toString($this->headline);
}
2022-06-17 18:02:55 +02:00
if ($this->label) {
return $this->model()->toString($this->label);
}
2022-06-17 17:51:59 +02:00
return ucfirst($this->name);
}
]
];