Ah! Da hab ich dich missverstanden. Der Callback gehört zu einer Operation meines DCAs:
PHP-Code:
'operations' => array
(
'toggle' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_products']['toggle'],
'icon' => 'visible.svg',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => array('tl_products', 'toggleIcon')
)
)
Die Funktion sieht in meinem DCA aktuell so aus:
PHP-Code:
class tl_products extends Backend
{
private $security;
public function __construct(Security $security)
{
$this->security = $security;
}
public function toggleIcon(TokenInterface $token, $row, $href, $label, $title, $icon, $attributes)
{
$user = $this->security->getUser();
if (strlen($this->Input->get('tid'))) {
$this->toggleVisibility($this->Input->get('tid'), ($this->Input->get('state') == 0));
$this->redirect($this->getReferer());
}
$href .= '&id='.$this->Input->get('id').'&tid='.$row['id'].'&state='.$row[''];
if (!$row['published']){
$icon = 'invisible.gif';
}
return '<a href="'.$this->addToUrl($href).'" title="'.specialchars($title).'"'.$attributes.'>'.$this->generateImage($icon, $label).'</a> ';
}
...
}
Lesezeichen