Fix et2-select widgets in template did not validate

This commit is contained in:
nathan 2022-07-15 12:48:25 -06:00
parent 2571d90691
commit 5793b462ba
2 changed files with 10 additions and 5 deletions

View File

@ -420,13 +420,14 @@ class Widget
if (!isset($class_name))
{
list($basetype) = explode('-',$type);
if (//dont think this is used: !class_exists($class_name = 'etemplate_widget_'.str_replace('-','_',$type)) &&
!class_exists($class_name = __CLASS__.'\\'.ucfirst($basetype)) &&
$exploded = explode('-', $type);
$basetype = $exploded[0] == "et2" ? $exploded[1] : $exploded[0];
if(//dont think this is used: !class_exists($class_name = 'etemplate_widget_'.str_replace('-','_',$type)) &&
!class_exists($class_name = __CLASS__ . '\\' . ucfirst($basetype)) &&
// widgets supplied by application in class ${app}_widget_etemplate or ${app}_${subtype}_widget_etemplate
!(isset($GLOBALS['egw_info']['apps'][$basetype]) &&
(class_exists($class_name = str_replace('-','_',$type).'_etemplate_widget') ||
class_exists($class_name = $basetype.'_etemplate_widget'))))
(class_exists($class_name = str_replace('-', '_', $type) . '_etemplate_widget') ||
class_exists($class_name = $basetype . '_etemplate_widget'))))
{
// Try for base type, it's probably better than the root
if(isset(self::$widget_registry[$basetype]) && self::$widget_registry[$basetype] !== $class_name)

View File

@ -560,6 +560,10 @@ class Select extends Etemplate\Widget
{
$widget = $widget_type;
$widget_type = $widget->attrs['type'] ? $widget->attrs['type'] : $widget->type;
if(str_starts_with($widget_type, 'et2-'))
{
$widget_type = str_replace('et2-', '', $widget_type);
}
}
// Legacy / static support
// Have to do this explicitly, since legacy options is not defined on class level