Namespace sap.ui.core.LabelEnablementModule: sap/ui/core/LabelEnablement
Helper functionality for enhancement of a Label with common label functionality.
Since: 1.28.0.
true
when the given control is required (property 'required') or one of its referencing labels, false
otherwise.Usage: The function can be called with a control prototype: sap.ui.core.LabelEnablement.enrich(my.Label.prototype);
Or the function can be called on instance level in the init function of a label control: my.Label.prototype.init: function(){ sap.ui.core.LabelEnablement.enrich(this); }
Preconditions: The given control must implement the interface sap.ui.core.Label and have an association 'labelFor' with cardinality 0..1. This function extends existing API functions. Ensure not to override this extensions AFTER calling this function.
What does this function do?
A mechanismn is added that ensures that a bidirectional reference between the label and it's labeled control is established: The label references the labeled control via the html 'for' attribute (@see sap.ui.core.LabelEnablement#writeLabelForAttribute). If the labeled control supports the aria-labelledby attribute. A reference to the label is added automatically.
In addition an alternative to apply a for reference without influencing the labelFor association of the API is applied (e.g. used by Form). For this purpose the functions setAlternativeLabelFor and getLabelForRendering are added.
{sap.ui.core.Control} | oControl | the label control which should be enriched with further label functionality. |
Error if the given control cannot be enriched to violated preconditions (see above) |
{sap.ui.core.Element} | oElement | The element whose referencing labels should be returned |
{string[]} | an array of ids of the labels referencing the given element |
true
when the given control is required (property 'required') or one of its referencing labels, false
otherwise. {sap.ui.core.Element} | oElement | The element which should be checked for its required state |
- Since:
- 1.29.0
{boolean} | true when the given control is required (property 'required') or one of its referencing labels, false otherwise |
{sap.ui.core.RenderManager} | oRenderManager | The RenderManager that can be used for writing to the render-output-buffer. |
{sap.ui.core.Label} | oLabel | The label for which the 'for' html attribute should be written to the render-output-buffer. |