From abba4833776fd821201073a03a7dc2d279137738 Mon Sep 17 00:00:00 2001 From: ralf Date: Sat, 9 Apr 2022 09:15:18 +0300 Subject: [PATCH] limit et2-buttononly w/o background_image conversation to et2-image to non-list / -NM templates --- api/etemplate.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/etemplate.php b/api/etemplate.php index 13a445ca9a..9fd8ab4735 100644 --- a/api/etemplate.php +++ b/api/etemplate.php @@ -150,18 +150,20 @@ function send_template() }, $str); // fix --> - $str = preg_replace_callback('##u', function($matches) + $str = preg_replace_callback('##u', function($matches) use ($name) { $tag = 'et2-button'; preg_match_all('/(^| )([a-z0-9_-]+)="([^"]+)"/', $matches[2], $attrs, PREG_PATTERN_ORDER); $attrs = array_combine($attrs[2], $attrs[3]); // replace buttononly tag with noSubmit="true" attribute if (!empty($matches[1])) $attrs['noSubmit'] = 'true'; - // replace not set background_image attribute with new et2-button-image tag - if (!empty($attrs['image']) && (empty($attrs['background_image']) || $attrs['background_image'] === 'false')) + // replace not set background_image attribute with et2-image tag, if not in NM / lists + if (!empty($attrs['image']) && (empty($attrs['background_image']) || $attrs['background_image'] === 'false') && + !preg_match('/^(index|list)/', $name)) { $tag = 'et2-image'; $attrs['src'] = $attrs['image']; + unset($attrs['image']); } // novalidation --> noValidation if (!empty($attrs['novalidation']) && in_array($attrs['novalidation'], ['true', '1'], true))