Beispiel #1
0
    /**
     * Add the type of content element
     *
     * @param array $arrRow
     *
     * @return string
     */
    public function addCteType($arrRow)
    {
        $key = $arrRow['invisible'] ? 'unpublished' : 'published';
        $type = $GLOBALS['TL_LANG']['CTE'][$arrRow['type']][0] ?: ' ';
        $class = 'limit_height';
        // Remove the class if it is a wrapper element
        if (in_array($arrRow['type'], $GLOBALS['TL_WRAPPERS']['start']) || in_array($arrRow['type'], $GLOBALS['TL_WRAPPERS']['separator']) || in_array($arrRow['type'], $GLOBALS['TL_WRAPPERS']['stop'])) {
            $class = '';
            if (($group = $this->getContentElementGroup($arrRow['type'])) !== null) {
                $type = $GLOBALS['TL_LANG']['CTE'][$group] . ' (' . $type . ')';
            }
        } elseif (in_array($arrRow['type'], $GLOBALS['TL_WRAPPERS']['single'])) {
            if (($group = $this->getContentElementGroup($arrRow['type'])) !== null) {
                $type = $GLOBALS['TL_LANG']['CTE'][$group] . ' (' . $type . ')';
            }
        }
        // Add the ID of the aliased element
        if ($arrRow['type'] == 'alias') {
            $type .= ' ID ' . $arrRow['cteAlias'];
        }
        // Add the protection status
        if ($arrRow['protected']) {
            $type .= ' (' . $GLOBALS['TL_LANG']['MSC']['protected'] . ')';
        } elseif ($arrRow['guests']) {
            $type .= ' (' . $GLOBALS['TL_LANG']['MSC']['guests'] . ')';
        }
        // Add the headline level (see #5858)
        if ($arrRow['type'] == 'headline') {
            if (is_array($headline = deserialize($arrRow['headline']))) {
                $type .= ' (' . $headline['unit'] . ')';
            }
        }
        // Limit the element's height
        if (!Config::get('doNotCollapse')) {
            $class .= ' h64';
        }
        $objModel = new ContentModel();
        $objModel->setRow($arrRow);
        return '
<div class="cte_type ' . $key . '">' . $type . '</div>
<div class="' . trim($class) . '">
' . String::insertTagToSrc($this->getContentElement($objModel)) . '
</div>' . "\n";
    }