blockly > Extensions > buildTooltipWithFieldText
Extensions.buildTooltipWithFieldText() function
Builds an extension function that will install a dynamic tooltip. The tooltip message should include the string '%1' and that string will be replaced with the text of the named field.
Signature:
export declare function buildTooltipWithFieldText(msgTemplate: string, fieldName: string): (this: Block) => void;
Parameters
Parameter |
Type |
Description |
msgTemplate |
string |
The template form to of the message text, with %1 placeholder. |
fieldName |
string |
The field with the replacement text. |
Returns:
(this: Block) => void
The extension function.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["`Extensions.buildTooltipWithFieldText()` creates a dynamic tooltip for blocks, updating the tooltip text based on a specified field's value."],["The tooltip message is constructed using a template with '%1' as a placeholder, which is replaced with the content of the designated field."],["It accepts two parameters: `msgTemplate`, a string containing the tooltip template, and `fieldName`, identifying the field providing the replacement text."],["This function returns an extension function that can be applied to blocks to enable dynamic tooltips."]]],[]]