From 3236a41c3a779e2fa17172db4220807263a3f6a2 Mon Sep 17 00:00:00 2001 From: Carlos Castillo Date: Thu, 10 Mar 2022 10:13:08 -0500 Subject: [PATCH] MDL-74150 tool_componentlibrary: Add title attribute to core/toggle --- .../tool/componentlibrary/content/moodle/components/toggle.md | 4 ++++ lib/templates/toggle.mustache | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/admin/tool/componentlibrary/content/moodle/components/toggle.md b/admin/tool/componentlibrary/content/moodle/components/toggle.md index 15b1c8a564c..f3194318d59 100644 --- a/admin/tool/componentlibrary/content/moodle/components/toggle.md +++ b/admin/tool/componentlibrary/content/moodle/components/toggle.md @@ -19,6 +19,7 @@ The parameters for the template context are: * checked: If the initial status is checked. * disabled: If toggle input is disabled. * dataattributes: Array of name/value elements added as data-attributes. +* title: Title text. * label: Label text. * labelclasses: Any extra classes added to the label container. @@ -35,6 +36,7 @@ Checked toggle and with "sr-only" label. "name": "action", "value": "toggle-status" }], + "title": "Toggle Enabled", "label": "Enable/disable status", "labelclasses": "sr-only" } @@ -52,6 +54,7 @@ Disabled toggle with extra classes. "name": "action", "value": "toggle-status" }], + "title": "Toggle Disabled", "label": "Enable/disable status" } {{< /mustache >}} @@ -68,6 +71,7 @@ The parameters that you can define are: * disabled * labelmarkup: Label element code block. * Should include *class="custom-control-label"*. +* title: Title text. * label: Label text. * labelclasses: Any extra classes added to the label container. diff --git a/lib/templates/toggle.mustache b/lib/templates/toggle.mustache index 5bac5ae4301..c1f19fa9aa9 100644 --- a/lib/templates/toggle.mustache +++ b/lib/templates/toggle.mustache @@ -28,6 +28,7 @@ "name": "action", "value": "toggle-reality" }], + "title": "Title example", "label": "Enable/disable reality", "labelclasses": "sr-only" } @@ -41,7 +42,7 @@ {{#disabled}}disabled{{/disabled}} {{/attributes}}> {{$labelmarkup}} -