0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00

Document idForLabel on the telepath widget API

Fixes #7145
This commit is contained in:
Matt Westcott 2021-05-04 15:33:08 +01:00 committed by Matt Westcott
parent 19671c7073
commit 9d29ba862c

View File

@ -49,7 +49,11 @@ The JavaScript object associated with a widget instance should provide a single
A widget's state will often be the same as the form field's value, but may contain additional data beyond what is processed in the form submission. For example, a page chooser widget consists of a hidden form field containing the page ID, and a read-only label showing the page title: in this case, the page ID by itself does not provide enough information to render the widget, and so the state is defined as a dictionary with `id` and `title` items.
The value returned by ``render`` is a 'bound widget' object allowing this widget instance's data to be accessed. This object should implement the following methods:
The value returned by ``render`` is a 'bound widget' object allowing this widget instance's data to be accessed. This object should implement the following attributes and methods:
.. js:attribute:: idForLabel
The HTML ID to use as the ``for`` attribute of a label referencing this widget, or null if no suitable HTML element exists.
.. js:function:: getValue()