MDL-73935 core: Update supportemail to accept optional custom attributes

This allows calling code such as the generic error page to define the
styles of the anchor element.
This commit is contained in:
Michael Hawkins
2022-02-28 12:42:47 +08:00
parent a0b3cf4898
commit 533c5ccb86
+4 -1
View File
@@ -4132,9 +4132,10 @@ EOD;
/**
* Returns the HTML for the site support email link
*
* @param array $customattribs Array of custom attributes for the support email anchor tag.
* @return string The html code for the support email link.
*/
public function supportemail(): string {
public function supportemail(array $customattribs = []): string {
global $CFG;
$label = get_string('contactsitesupport', 'admin');
@@ -4148,6 +4149,8 @@ EOD;
$attributes = ['href' => $CFG->wwwroot . '/user/contactsitesupport.php'];
}
$attributes += $customattribs;
return html_writer::tag('a', $content, $attributes);
}