Fix for Vmview class function linkIcon which is compatible with Joomla 3.3

Started by juslintek, July 07, 2014, 19:13:21 PM

Previous topic - Next topic

juslintek

Here is how the function should look like to return image icon:


function linkIcon($link,$altText ='',$boutonName,$verifyConfigValue=false, $modal = true, $use_icon=true,$use_text=false,$class = ''){
if ($verifyConfigValue) {
if ( !VmConfig::get($verifyConfigValue, 0) ) return '';
}
$folder = 'media/system/images/'; //shouldn't be root slash before media, as it automatically tells to look in root directory, for media/system/ which is wrong it should append to root directory.
$text='';
if ( $use_icon ) $text .= JHtml::_('image', $folder.$boutonName.'.png',  vmText::_($altText), null, false, false); //$folder shouldn't be as alt text, here it is: image(string $file, string $alt, mixed $attribs = null, boolean $relative = false, mixed $path_rel = false) : string, you should change first false to true if images are in templates media folder
if ( $use_text ) $text .= ' '. vmText::_($altText);
if ( $text=='' )  $text .= ' '. vmText::_($altText);
if ($modal) return '<a '.$class.' class="modal" rel="{handler: \'iframe\', size: {x: 700, y: 550}}" title="'. vmText::_($altText).'" href="'.JRoute::_($link, FALSE).'">'.$text.'</a>';
else return '<a '.$class.' title="'. vmText::_($altText).'" href="'.JRoute::_($link, FALSE).'">'.$text.'</a>';
}


Original linkIcon function found in latest VM 2.9.8 vmview class.


function linkIcon($link,$altText ='',$boutonName,$verifyConfigValue=false, $modal = true, $use_icon=true,$use_text=false,$class = ''){
if ($verifyConfigValue) {
if ( !VmConfig::get($verifyConfigValue, 0) ) return '';
}
$folder = '/media/system/images/';
$text='';
if ( $use_icon ) $text .= JHtml::_('image', $boutonName.'.png', $folder, null, null, vmText::_($altText));
if ( $use_text ) $text .= '&nbsp;'. vmText::_($altText);
if ( $text=='' )  $text .= '&nbsp;'. vmText::_($altText);
if ($modal) return '<a '.$class.' class="modal" rel="{handler: \'iframe\', size: {x: 700, y: 550}}" title="'. vmText::_($altText).'" href="'.JRoute::_($link, FALSE).'">'.$text.'</a>';
else return '<a '.$class.' title="'. vmText::_($altText).'" href="'.JRoute::_($link, FALSE).'">'.$text.'</a>';
}

Milbo

Very nice, I wonder why it got broken. It fixed it also on j2.5. Well done
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/