Actions

Difference between revisions of "Developer Area/Core Subsystems/Form API (Pieforms)/Form APIElements/Help Icon"

From Mahara Wiki

< Developer Area‎ | Core Subsystems‎ | Form API (Pieforms)‎ | Form APIElements
(Notes on the Help Icon in Pieforms)
 
(No difference)

Latest revision as of 10:08, 22 December 2022

Help Icons can be added to Pieform elements by the addition of 'help' => true to the form element array. This will generate a help icon that will load a file via an AJAX callback.

The file name is constructed in get_helpfile_location() and requires that the form also has pluginname and plugintype also set.

Optional: 'helpinlabel' => true can be set to move the help icon into the label so it is close to the text of the label rather than the default location on the far right of the rendered element. This may be of use when a form has non-default layout.

Minimal example:

$searchform = [
    'name' => 'exampleform',
    'plugintype' => 'core',
    'pluginname' => 'view',
    'elements' => [
        'examplecheckbox' => [
            'type' => 'checkbox',
            'class' => 'stacked',
            'title' => get_string('examplecheckboxtitle', 'view'),
            'defaultvalue' => $examplecheckbox,
            'help' => true,
            'helpinlabel' => true,
        ],
    ],
];