Stay organized with collections Save and categorize content based on your preferences.

blockly > Extensions > buildTooltipForDropdown

Extensions.buildTooltipForDropdown() function

Builds an extension function that will map a dropdown value to a tooltip string.

This method includes multiple checks to ensure tooltips, dropdown options, and message references are aligned. This aims to catch errors as early as possible, without requiring developers to manually test tooltips under each option. After the page is loaded, each tooltip text string will be checked for matching message keys in the internationalized string table. Deferring this until the page is loaded decouples loading dependencies. Later, upon loading the first block of any given type, the extension will validate every dropdown option has a matching tooltip in the lookupTable. Errors are reported as warnings in the console, and are never fatal.

Signature:

export declare function buildTooltipForDropdown(dropdownName: string, lookupTable: {
    [key: string]: string;
}): Function;

Parameters

Parameter Type Description
dropdownName string The name of the field whose value is the key to the lookup table.
lookupTable { [key: string]: string; } The table of field values to tooltip text.

Returns:

Function

The extension function.