سؤال

مرحبًا ، لقد قمت بإنشاء رابط زر مخصص في قسم المسؤول في مكوني ، شيء من هذا القبيل:

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

ومع ذلك ، لا يتم تعيين صورة لها ولا أعرف كيفية تعيين واحدة إلى الزر. هل يعرف أحد كيف يمكنني القيام بذلك؟

هل كانت مفيدة؟

المحلول

تحتاج إلى إنشاء فئة CSS تسمى icon-32-export مع خلفية الصورة.

هنا مثال:

<?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