mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-50839 user_menu: Allow themes to set User menu avatar size.
Added an @array "options" parameter to user_get_user_navigation_info(), for passing in avatarsize, and possibly other options in future. Also removed an errant parameter in the /lib/outputrenderers.php user_get_user_navigation_info() call, as there was no corresponding parameter in the function definition. (Test written by Jetha Chan.)
This commit is contained in:
parent
9325cd963f
commit
9dcd50358a
3 changed files with 32 additions and 7 deletions
16
user/lib.php
16
user/lib.php
|
@ -727,6 +727,9 @@ function user_convert_text_to_menu_items($text, $page) {
|
|||
*
|
||||
* @param stdclass $user user object.
|
||||
* @param moodle_page $page page object.
|
||||
* @param array $options associative array.
|
||||
* options are:
|
||||
* - avatarsize=35 (size of avatar image)
|
||||
* @return stdClass $returnobj navigation information object, where:
|
||||
*
|
||||
* $returnobj->navitems array array of links where each link is a
|
||||
|
@ -769,7 +772,7 @@ function user_convert_text_to_menu_items($text, $page) {
|
|||
* mnetidprovidername string name of the MNet provider
|
||||
* mnetidproviderwwwroot string URL of the MNet provider
|
||||
*/
|
||||
function user_get_user_navigation_info($user, $page) {
|
||||
function user_get_user_navigation_info($user, $page, $options = null) {
|
||||
global $OUTPUT, $DB, $SESSION, $CFG;
|
||||
|
||||
$returnobject = new stdClass();
|
||||
|
@ -787,12 +790,13 @@ function user_get_user_navigation_info($user, $page) {
|
|||
$returnobject->metadata['userprofileurl'] = new moodle_url('/user/profile.php', array(
|
||||
'id' => $user->id
|
||||
));
|
||||
|
||||
$avataroptions = array('link' => false, 'visibletoscreenreaders' => false);
|
||||
if (!empty($options['avatarsize'])) {
|
||||
$avataroptions['size'] = $options['avatarsize'];
|
||||
}
|
||||
$returnobject->metadata['useravatar'] = $OUTPUT->user_picture (
|
||||
$user,
|
||||
array(
|
||||
'link' => false,
|
||||
'visibletoscreenreaders' => false
|
||||
)
|
||||
$user, $avataroptions
|
||||
);
|
||||
// Build a list of items for a regular user.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue