From f2b27cca7562399c0e86f00233130c58d6001420 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 15 Apr 2022 11:02:40 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#1558 --- .../Fieldtype/FieldtypeRepeater/config.php | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/wire/modules/Fieldtype/FieldtypeRepeater/config.php b/wire/modules/Fieldtype/FieldtypeRepeater/config.php index 77855655..82e475a9 100644 --- a/wire/modules/Fieldtype/FieldtypeRepeater/config.php +++ b/wire/modules/Fieldtype/FieldtypeRepeater/config.php @@ -87,6 +87,9 @@ class FieldtypeRepeaterConfigHelper extends Wire { $inputfields->add($f); // ------------------------------------------------- + + /** @var ProcessTemplate $processTemplate */ + $processTemplate = $modules->getModule('ProcessTemplate', array('noInit' => true)); /** @var InputfieldAsmSelect $select */ $select = $modules->get('InputfieldAsmSelect'); @@ -104,15 +107,8 @@ class FieldtypeRepeaterConfigHelper extends Wire { foreach($template->fieldgroup as $f) { /** @var Field $f */ $f = $template->fieldgroup->getField($f->id, true); // get in context - $columnWidth = (int) $f->get('columnWidth'); - - $attrs = array( - 'selected' => 'selected', - 'data-status' => str_replace('Fieldtype', '', $f->type) . ' ' . ($columnWidth > 0 ? $columnWidth . '%': '100%'), - 'data-desc' => $f->getLabel(), - ); - $icon = $f->getIcon(); - if($icon) $attrs['data-handle'] = ""; + $attrs = $processTemplate->getAsmListAttrs($f); + $attrs['selected'] = 'selected'; $select->addOption($f->id, $f->name, $attrs); } @@ -122,13 +118,7 @@ class FieldtypeRepeaterConfigHelper extends Wire { if(($f->flags & Field::flagPermanent) && !$this->wire('config')->advanced) continue; $name = $f->name; if($f->flags & Field::flagSystem) $name .= "*"; - $columnWidth = (int) $f->get('columnWidth'); - $attrs = array( - 'data-desc' => $f->getLabel(), - 'data-status' => str_replace('Fieldtype', '', $f->type) . ' ' . ($columnWidth > 0 ? $columnWidth . '%': '100%'), - ); - $icon = $f->getIcon(); - if($icon) $attrs['data-handle'] = ""; + $attrs = $processTemplate->getAsmListAttrs($f); $select->addOption($f->id, $name, $attrs); }