1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-10 00:37:02 +02:00
This commit is contained in:
Ryan Cramer
2023-05-18 09:41:08 -04:00
parent 47086751d2
commit 3598fb113b

View File

@@ -142,7 +142,8 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
$out = '';
$repeaterTitle = $this->field ? $this->field->get('repeaterTitle') : '';
$colorPrefix = "\rCOLOR\r";
$colorPrefix = "\tC/O/L/O/R:";
$hasColorPrefix = false;
if($page->id && $repeaterTitle) {
// custom repeater titles specified
@@ -156,6 +157,7 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
if(strpos($repeaterTitle, '#') !== false) {
$repeaterTitle = preg_replace('/#([a-f\d]{3,})/i', "$colorPrefix$1", $repeaterTitle);
if(strpos($repeaterTitle, $colorPrefix) !== false) $hasColorPrefix = true;
}
if(strpos($repeaterTitle, '{') !== false) {
@@ -208,8 +210,10 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
$sp = html_entity_decode('​', 0, 'UTF-8');
$out = str_replace('#', "#$sp", $out);
}
$out = str_replace($colorPrefix, '#', $out);
if($hasColorPrefix && strpos($out, $colorPrefix) === strrpos($out, $colorPrefix)) {
$out = str_replace($colorPrefix, '#', $out);
}
return $out;
}
@@ -627,7 +631,12 @@ class InputfieldRepeater extends Inputfield implements InputfieldItemList {
if(!$isPost && count($typeStyles)) {
$styles = "<style type='text/css'>" . implode("\n", $typeStyles) . "</style>";
$this->wire()->adminTheme->addExtraMarkup('head', $styles);
if($this->wire()->config->ajax && ($this->page instanceof RepeaterPage || $this->hasPage instanceof RepeaterPage)) {
// ajax-rendered nested repeater page
$this->prependMarkup .= $styles;
} else {
$this->wire()->adminTheme->addExtraMarkup('head', $styles);
}
}
return $form;