From a0905f33eabec71e411c837967750e15d6febf19 Mon Sep 17 00:00:00 2001
From: Derek Allard
Date: Mon, 5 Jul 2010 08:11:33 -0400
Subject: img() will now generate an empty string as an alt attribute if one is
not provided.
---
system/helpers/html_helper.php | 6 ++++++
user_guide/changelog.html | 3 ++-
user_guide/helpers/html_helper.html | 4 ++--
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 4afa678a3..cd7b4ce6b 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -199,6 +199,12 @@ if ( ! function_exists('img'))
$src = array('src' => $src);
}
+ // If there is no alt attribute defined, set it to an empty string
+ if ( ! isset($src['alt']))
+ {
+ $src['alt'] = '';
+ }
+
$img = '$v)
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 1aa06d388..124a1cb9f 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -112,7 +112,7 @@ Hg Tag:
Helpers
- - Added convert_accented_characters() function to text helper.
+ - Added convert_accented_characters() function to text helper.
- Added accept-charset to the list of inserted attributes of form_open() in the Form Helper.
- Deprecated the dohash() function in favour of do_hash() for naming consistency.
- Non-backwards compatible change made to get_dir_file_info() in the File Helper. No longer recurses
@@ -124,6 +124,7 @@ Hg Tag:
- Modified prep_url() so as to not prepend http:// if the supplied string already has a scheme.
- Modified get_file_info in the file helper, changing filectime() to filemtime() for dates.
- Modified smiley_js() to add optional third parameter to return only the javascript with no script tags.
+ - The img() function of the HTML helper will now generate an empty string as an alt attribute if one is not provided.
Other Changes
diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html
index a0ac8bdde..50a1c48a4 100644
--- a/user_guide/helpers/html_helper.html
+++ b/user_guide/helpers/html_helper.html
@@ -95,8 +95,8 @@ second the size of the heading. Example:
// gives <img src="http://site.com/images/picture.jpg" />
There is an optional second parameter that is a TRUE/FALSE value that specifics if the src should have the page specified by $config['index_page'] added to the address it creates. Presumably, this would be if you were using a media controller.
echo img('images/picture.jpg', TRUE);
-// gives <img src="http://site.com/index.php/images/picture.jpg" />
-Additionally, an associative array can be passed to the img() function for complete control over all attributes and values.
+// gives <img src="http://site.com/index.php/images/picture.jpg" alt="" />
+Additionally, an associative array can be passed to the img() function for complete control over all attributes and values. If an alt attribute is not provided, CodeIgniter will generate an empty string.
$image_properties = array(
'src' => 'images/picture.jpg',
'alt' => 'Me, demonstrating how to eat 4 slices of pizza at one time',
--
cgit v1.2.3-24-g4f1b