*/
public $visibletoscreenreaders = true;
+ /**
+ * @var bool Whether to include the fullname in the user picture link.
+ */
+ public $includefullname = false;
+
/**
* User picture constructor.
*
* - alttext=true (add image alt attribute)
* - class = image class attribute (default 'userpicture')
* - visibletoscreenreaders=true (whether to be visible to screen readers)
+ * - includefullname=false (whether to include the user's full name together with the user picture)
* @return string HTML fragment
*/
public function user_picture(stdClass $user, array $options = null) {
// get the image html output fisrt
$output = html_writer::empty_tag('img', $attributes);
+ // Show fullname together with the picture when desired.
+ if ($userpicture->includefullname) {
+ $output .= fullname($userpicture->user);
+ }
+
// then wrap it in link if needed
if (!$userpicture->link) {
return $output;
used to perform implicit validation of submitted values - without the need to explicitly add the validation rules to
every form. The method should accept a single parameter with the submitted value. It should return a string with the
eventual validation error, or an empty value if the validation passes.
+* New user_picture attribute $includefullname to determine whether to include the user's full name with the user's picture.
=== 3.3.1 ===