Contao\DC_Table::formatGroupHeader PHP Метод

formatGroupHeader() защищенный Метод

Return the formatted group header as string
protected formatGroupHeader ( string $field, mixed $value, integer $mode, array $row ) : string
$field string
$value mixed
$mode integer
$row array
Результат string
    protected function formatGroupHeader($field, $value, $mode, $row)
    {
        static $lookup = array();
        if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['eval']['isAssociative'] || array_is_assoc($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options'])) {
            $group = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options'][$value];
        } elseif (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback'])) {
            if (!isset($lookup[$field])) {
                $strClass = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback'][0];
                $strMethod = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['options_callback'][1];
                $this->import($strClass);
                $lookup[$field] = $this->{$strClass}->{$strMethod}($this);
            }
            $group = $lookup[$field][$value];
        } else {
            $group = is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['reference'][$value]) ? $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['reference'][$value][0] : $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['reference'][$value];
        }
        if (empty($group)) {
            $group = is_array($GLOBALS['TL_LANG'][$this->strTable][$value]) ? $GLOBALS['TL_LANG'][$this->strTable][$value][0] : $GLOBALS['TL_LANG'][$this->strTable][$value];
        }
        if (empty($group)) {
            $group = $value;
            if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['eval']['isBoolean'] && $value != '-') {
                $group = is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['label']) ? $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['label'][0] : $GLOBALS['TL_DCA'][$this->strTable]['fields'][$field]['label'];
            }
        }
        // Call the group callback ($group, $sortingMode, $firstOrderBy, $row, $this)
        if (is_array($GLOBALS['TL_DCA'][$this->strTable]['list']['label']['group_callback'])) {
            $strClass = $GLOBALS['TL_DCA'][$this->strTable]['list']['label']['group_callback'][0];
            $strMethod = $GLOBALS['TL_DCA'][$this->strTable]['list']['label']['group_callback'][1];
            $this->import($strClass);
            $group = $this->{$strClass}->{$strMethod}($group, $mode, $field, $row, $this);
        } elseif (is_callable($GLOBALS['TL_DCA'][$this->strTable]['list']['label']['group_callback'])) {
            $group = $GLOBALS['TL_DCA'][$this->strTable]['list']['label']['group_callback']($group, $mode, $field, $row, $this);
        }
        return $group;
    }