tl_page::toggleIcon PHP 메소드

toggleIcon() 공개 메소드

Return the "toggle visibility" button
public toggleIcon ( array $row, string $href, string $label, string $title, string $icon, string $attributes ) : string
$row array
$href string
$label string
$title string
$icon string
$attributes string
리턴 string
    public function toggleIcon($row, $href, $label, $title, $icon, $attributes)
    {
        if (strlen(Input::get('tid'))) {
            $this->toggleVisibility(Input::get('tid'), Input::get('state') == 1, @func_get_arg(12) ?: null);
            $this->redirect($this->getReferer());
        }
        // Check permissions AFTER checking the tid, so hacking attempts are logged
        if (!$this->User->hasAccess('tl_page::published', 'alexf')) {
            return '';
        }
        $href .= '&tid=' . $row['id'] . '&state=' . ($row['published'] ? '' : 1);
        if (!$row['published']) {
            $icon = 'invisible.svg';
        }
        $objPage = $this->Database->prepare("SELECT * FROM tl_page WHERE id=?")->limit(1)->execute($row['id']);
        if (!$this->User->hasAccess($row['type'], 'alpty') || !$this->User->isAllowed(BackendUser::CAN_EDIT_PAGE, $objPage->row())) {
            return Image::getHtml($icon) . ' ';
        }
        return '<a href="' . $this->addToUrl($href) . '" title="' . StringUtil::specialchars($title) . '"' . $attributes . '>' . Image::getHtml($icon, $label, 'data-state="' . ($row['published'] ? 1 : 0) . '"') . '</a> ';
    }