Totara Learn Open Discussions

Theme Question - Mustache / Logo Image

 
Barnes (Core Developer)Brian
Re: Theme Question - Mustache / Logo Image
Barnes (Core Developer)Brian 发表于 2021年07月26日 Monday 13:48
小组 Totara

Hi John,

When using the `#pix` helper to get the logo, yes it will rely on the image as provided in the theme. This improves caching of icons (eg. up and down arrows etc.) and is widely used throughout the site.

After uploading a logo through Ventura or Basis theme settings (I'm assuming you're trying on t12 or above here), the URL for the logo can be retrieved using `logourl` in `totara_core\masthead_logo` template, or by providing`$PAGE->theme->setting_file_url('logo', 'logo');` to your mustache template. For an example (including fallback code in the case where the setting is not set), have a look at the `export_for_template` method in `server/totara/core/classes/output/masthead_logo.php` (TXP13+).

PS. Don't forget the alt text so that a screen reader user knows what the logo is (`logoalt` in the masthead template or `$PAGE->theme->settings->alttext` from PHP).

Kind regards