44 lines
No EOL
857 B
PHP
44 lines
No EOL
857 B
PHP
<?php
|
|
|
|
|
|
function allYears ($article) {
|
|
$years = new Pages([$article->parent()]);
|
|
|
|
foreach (site()->find('textes')->children() as $year) {
|
|
if ($year->linkedTexts()->toPages()->has($article)) {
|
|
$years = $years->add($year);
|
|
}
|
|
}
|
|
return $years;
|
|
}
|
|
|
|
function setTitleFontSizeClass($title, $level = 'h1')
|
|
{
|
|
$length = strlen($title);
|
|
|
|
if ($level === 'h1') {
|
|
switch (true) {
|
|
case ($length < 35):
|
|
return 'fs-xxl';
|
|
break;
|
|
|
|
case ($length < 70):
|
|
return 'fs-xl';
|
|
break;
|
|
|
|
default:
|
|
return 'fs-l';
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
function getAuthorBySlug($slug)
|
|
{
|
|
$site = site();
|
|
$authors = page("auteurs")->children();
|
|
$author = $authors->find($slug);
|
|
|
|
return $author;
|
|
}
|
|
|