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

37 lines
845 B
PHP
Raw Normal View History

2021-10-29 18:05:46 +02:00
<?php
use Kirby\Toolkit\I18n;
return [
2022-08-31 16:08:03 +02:00
'props' => [
/**
* The headline for the section. This can be a simple string or a template with additional info from the parent page.
2022-12-19 16:26:24 +01:00
* @deprecated 3.8.0 Use `label` instead
2022-08-31 16:08:03 +02:00
*/
'headline' => function ($headline = null) {
return I18n::translate($headline, $headline);
},
/**
* The label for the section. This can be a simple string or
* a template with additional info from the parent page.
* Replaces the `headline` prop.
*/
'label' => function ($label = null) {
return I18n::translate($label, $label);
}
],
'computed' => [
'headline' => function () {
if ($this->label) {
return $this->model()->toString($this->label);
}
2022-12-19 16:26:24 +01:00
if ($this->headline) {
return $this->model()->toString($this->headline);
}
2022-08-31 16:08:03 +02:00
return ucfirst($this->name);
}
]
2021-10-29 18:05:46 +02:00
];