문제

Hi I have created a custom button link in the admin section of my component, something like this:

$bar = & JToolBar::getInstance('toolbar');
$bar->appendButton( 'Link', 'export', 'Export', 'index.php?option=com_component&task=export&format=raw' );

However no image is assigned to it and I don't know how to assign one to the button. Does anyone know how I can do this?

도움이 되었습니까?

해결책

You need to create CSS class called icon-32-export with image background.

Here is an example:

<?php

// Add CSS class to the document, it's better to have it in external CSS document
$imgPath = JRoute::_('/administrator/templates/khepri/images/toolbar/icon-32-new.png');
JFactory::getDocument()->addStyleDeclaration(".icon-32-export { background: url($imgPath); }");

//
$bar = & JToolBar::getInstance('toolbar');
$url = JRoute::_('index.php?option=com_component&task=export&format=raw');
$bar->appendButton( 'Link', 'export', 'Export', $url);

?>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top