Revert "MDL-46226 core: pix_icon no longer sets title to the alt text"
authorSam Hemelryk <sam@moodle.com>
Thu, 17 Jul 2014 01:57:29 +0000 (13:57 +1200)
committerSam Hemelryk <sam@moodle.com>
Thu, 17 Jul 2014 01:57:29 +0000 (13:57 +1200)
lib/outputcomponents.php

index 5b51cdf..76b0c83 100644 (file)
@@ -510,8 +510,9 @@ class pix_icon implements renderable {
         if (empty($this->attributes['class'])) {
             $this->attributes['class'] = 'smallicon';
         }
         if (empty($this->attributes['class'])) {
             $this->attributes['class'] = 'smallicon';
         }
-
-        if (empty($this->attributes['title'])) {
+        if (!isset($this->attributes['title'])) {
+            $this->attributes['title'] = $this->attributes['alt'];
+        } else if (empty($this->attributes['title'])) {
             // Remove the title attribute if empty, we probably want to use the parent node's title
             // and some browsers might overwrite it with an empty title.
             unset($this->attributes['title']);
             // Remove the title attribute if empty, we probably want to use the parent node's title
             // and some browsers might overwrite it with an empty title.
             unset($this->attributes['title']);