From 95f68a4b3db5d1bab7c79f81a2692ba2207d1ca2 Mon Sep 17 00:00:00 2001 From: ralf Date: Mon, 22 Aug 2022 22:31:11 +0200 Subject: [PATCH] convert buttons without background_image attribute to et2-button-icon with name attribute instead of image --- api/etemplate.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/api/etemplate.php b/api/etemplate.php index 84afd2c4d1..9add011de3 100644 --- a/api/etemplate.php +++ b/api/etemplate.php @@ -328,14 +328,11 @@ function send_template() if (!empty($attrs['image']) && (empty($attrs['background_image']) || $attrs['background_image'] === 'false') && !preg_match('/^(index|list)/', $name)) { - $tag = 'et2-image'; - $attrs['src'] = $attrs['image']; - $attrs['class'] = (!empty($attrs['class']) ? $attrs['class'].' ':'').'imageButton'; - unset($attrs['image']); - // Was expected to submit. Images don't have noValidation, so add directly - if (!array_key_exists('onclick', $attrs) && empty($attrs['noSubmit'])) + $tag = 'et2-button-icon'; + if (!isset($attrs['name'])) { - $attrs['onclick'] = 'this.getInstanceManager().submit(this, undefined, ' . $attrs['noValidation'] . ')'; + $attrs['name'] = $attrs['image']; + unset($attrs['image']); } } unset($attrs['background_image']); @@ -362,7 +359,7 @@ function send_template() } // change all attribute-names of new et2-* widgets to camelCase, and other attribute modifications for all web-components - $str = preg_replace_callback('#<(et2|records)-([a-z-]+)\s(.*?")\s*/?>\s*<#s', static function(array $matches) + $str = preg_replace_callback('#<(et2|records)-([a-z-]+)\s(.*?")\s*/?>#s', static function(array $matches) { $attrs = parseAttrs($matches[3]);