diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 495589717..6d466a866 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -2332,6 +2332,8 @@ class MenuBlock extends DisplayBlock $sTarget = isset($aAction['target']) ? $aAction['target'] : ''; $oActionButton = ButtonUIBlockFactory::MakeLinkNeutral($sUrl, $sLabel, $sIconClass, $sTarget, utils::Sanitize($sActionId, '', utils::ENUM_SANITIZATION_FILTER_ELEMENT_IDENTIFIER)); + // ResourceId should not be sanitized + $oActionButton->AddDataAttribute('resource-id', $sActionId); $oActionButton->AddCSSClasses(['ibo-action-button', 'ibo-regular-action-button']); if (empty($sLabel)) { if (empty($aAction['tooltip'])) { diff --git a/sources/application/UI/Base/Component/Button/Button.php b/sources/application/UI/Base/Component/Button/Button.php index 2b488b8e5..9aeca2aed 100644 --- a/sources/application/UI/Base/Component/Button/Button.php +++ b/sources/application/UI/Base/Component/Button/Button.php @@ -94,6 +94,11 @@ class Button extends UIBlock */ public function __construct(string $sLabel, string $sId = null, string $sTooltip = '', string $sIconClass = '', string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColorScheme = self::DEFAULT_COLOR_SCHEME, string $sJsCode = '', string $sOnClickJsCode = '') { + // We only use resource ID (not sanitized) on button for now, but this might be reworked back into \UIBlock if needed + if (!is_null($sId)) { + $this->AddDataAttribute('resource-id', $sId); + } + parent::__construct($sId); $this->sLabel = $sLabel; diff --git a/sources/application/UI/Base/UIBlock.php b/sources/application/UI/Base/UIBlock.php index f32c94c4f..f0a770184 100644 --- a/sources/application/UI/Base/UIBlock.php +++ b/sources/application/UI/Base/UIBlock.php @@ -107,7 +107,7 @@ abstract class UIBlock implements iUIBlock /** @var array Cache for the CSS classes of a block inheritance. Key is the block class, value is an array of CSS classes */ private static $aBlocksInheritanceCSSClassesCache = []; - /** @var string $sId */ + /** @var string ID of the block */ protected $sId; /** diff --git a/templates/base/components/popover-menu/item/mode_js.html.twig b/templates/base/components/popover-menu/item/mode_js.html.twig index 3588e49fe..8c8452a9e 100644 --- a/templates/base/components/popover-menu/item/mode_js.html.twig +++ b/templates/base/components/popover-menu/item/mode_js.html.twig @@ -1,7 +1,7 @@ {% extends 'base/components/popover-menu/item/layout.html.twig' %} {% block iboPopoverMenuItem %} -