mirror of
https://github.com/processwire/processwire.git
synced 2025-08-15 11:14:12 +02:00
Fix issue processwire/processwire-issues#1716
This commit is contained in:
@@ -142,7 +142,8 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
|
|||||||
|
|
||||||
$out = '';
|
$out = '';
|
||||||
$repeaterTitle = $this->field ? $this->field->get('repeaterTitle') : '';
|
$repeaterTitle = $this->field ? $this->field->get('repeaterTitle') : '';
|
||||||
|
$colorPrefix = "\rCOLOR\r";
|
||||||
|
|
||||||
if($page->id && $repeaterTitle) {
|
if($page->id && $repeaterTitle) {
|
||||||
// custom repeater titles specified
|
// custom repeater titles specified
|
||||||
$hasCnt = stripos($repeaterTitle, '#n') !== false;
|
$hasCnt = stripos($repeaterTitle, '#n') !== false;
|
||||||
@@ -153,6 +154,10 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
|
|||||||
$repeaterTitle = str_replace("#n", "#$cnt", $repeaterTitle);
|
$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) {
|
if(strpos($repeaterTitle, '{') !== false) {
|
||||||
// formatted {label}
|
// formatted {label}
|
||||||
$out = $page->getText($repeaterTitle, true);
|
$out = $page->getText($repeaterTitle, true);
|
||||||
@@ -198,6 +203,13 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
|
|||||||
$pos = strrpos($out, ' ');
|
$pos = strrpos($out, ' ');
|
||||||
if($pos > ($maxlen / 2)) $out = substr($out, 0, $pos);
|
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;
|
return $out;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user