1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-13 18:24:57 +02:00
This commit is contained in:
Ryan Cramer
2023-05-03 14:05:58 -04:00
parent a9b656c45e
commit f2a72ad8ea

View File

@@ -142,7 +142,8 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
$out = '';
$repeaterTitle = $this->field ? $this->field->get('repeaterTitle') : '';
$colorPrefix = "\rCOLOR\r";
if($page->id && $repeaterTitle) {
// custom repeater titles specified
$hasCnt = stripos($repeaterTitle, '#n') !== false;
@@ -153,6 +154,10 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
$repeaterTitle = str_replace("#n", "#$cnt", $repeaterTitle);
}
if(strpos($repeaterTitle, '#') !== false) {
$repeaterTitle = preg_replace('/#([a-f\d]{3,})/i', "$colorPrefix$1", $out);
}
if(strpos($repeaterTitle, '{') !== false) {
// formatted {label}
$out = $page->getText($repeaterTitle, true);
@@ -198,6 +203,13 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
$pos = strrpos($out, ' ');
if($pos > ($maxlen / 2)) $out = substr($out, 0, $pos);
}
if(strpos($out, '#') !== false) {
$sp = html_entity_decode('​', 0, 'UTF-8');
$out = str_replace('#', "#$sp", $out);
}
$out = str_replace($colorPrefix, '#', $out);
return $out;
}