summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbtopro2013-10-25 05:33:07 (GMT)
committer btopro2013-10-25 05:33:07 (GMT)
commitef85772b22603c88619c5c1c3cf959e09a22ea7f (patch)
tree1ca95330ef0b57ef6fab77fcc1558f0ccd8f9c1f
parente2fe7f6383475661458fa6dbe3cce867ea15405f (diff)
added ability to render shortcodes directly to image tags with full title, alt, width, and height support
-rw-r--r--modules/cis_filter/cis_filter.module29
1 files changed, 28 insertions, 1 deletions
diff --git a/modules/cis_filter/cis_filter.module b/modules/cis_filter/cis_filter.module
index 43c8411..94132ab 100644
--- a/modules/cis_filter/cis_filter.module
+++ b/modules/cis_filter/cis_filter.module
@@ -128,7 +128,34 @@ function _cis_filter_link_render($url, $code, $link = '') {
if (isset($code['field']) && isset($data[$code['field']]['uri'])) {
// field must have a uri associated with it
$path = $data[$code['field']]['uri'];
- $link = l(t('@t', array('@t' => $code['text'])), $path);
+ // special case for rendering images via direct embed
+ if (isset($code['item_type']) && $code['item_type'] == 'image') {
+ $width = '';
+ $height = '';
+ if (isset($code['width'])) {
+ $width = 'width="' . $code['width'] . '"';
+ }
+ if(isset($code['height'])) {
+ $height = 'height="' . $code['height'] . '"';
+ }
+ $alt = '';
+ $title = '';
+ // support custom title and alt text
+ if (isset($code['text'])) {
+ $alt = $code['text'];
+ $title = $code['text'];
+ }
+ if (isset($code['alt'])) {
+ $alt = $code['alt'];
+ }
+ $link = "<img src=\"$path\" $width $height alt=\"$alt\" title=\"$title\" />";
+ }
+ else if (isset($code['text'])) {
+ $link = l(t('@t', array('@t' => $code['text'])), $path);
+ }
+ else {
+
+ }
}
else if (isset($code['text'])) {
$link = l(t('@t', array('@t' => $code['text'])), $link);