Project

General

Profile

Actions

Feature #44345

closed

backend_layout: customized width for columns

Added by Uwe Jakobs almost 12 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Could have
Assignee:
Category:
Backend User Interface
Target version:
Start date:
2013-01-06
Due date:
% Done:

0%

Estimated time:
PHP Version:
5.3
Tags:
Complexity:
Sprint Focus:

Description

Some editors wanted me to assimilate the columns width in the Backend with the output in Frontend. Since I am using "Backend Layouts" (Grid View), all columns are displayed with an equal width. The backend-Layout is rendered in the class typo3/sysext/backend/Classes/View/PageLayoutView.php, so I had to fiddle around here a little bit.

My small solution could be interesting for the community, so here it is:

in PageLayoutView.php replace lines 534 - 542


    // Add colgroups
    $colCount = intval($parser->setup['backend_layout.']['colCount']);
    $rowCount = intval($parser->setup['backend_layout.']['rowCount']);

    $grid .= '<colgroup>';
        for ($i = 0; $i < $colCount; $i++) {
            $grid .= '<col style="width:' . (100 / $colCount) . '%"></col>';
    }
    $grid .= '</colgroup>';

with these lines:

    // Add colgroups
    $colCount = intval($parser->setup['backend_layout.']['colCount']);
    $rowCount = intval($parser->setup['backend_layout.']['rowCount']);
    $colRatio = $parser->setup['backend_layout.']['colRatio'];

    $grid .= '<colgroup>';
    if ($colRatio){
        $splitRatioArr = explode('|',$colRatio);
        foreach ($splitRatioArr as $colWidth) {
            $grid .= '<col style="width:' . $colWidth . '%"></col>';
        }
    } else {
        for ($i = 0; $i < $colCount; $i++) {
            $grid .= '<col style="width:' . (100 / $colCount) . '%"></col>';
        }
    }
    $grid .= '</colgroup>';

This little exercise gives you the possibility to add a new Element to the backend_layout-Array: it is called colRatio and contains width-ratio in percentages (devided by the Pipe-Symbol |):

backend_layout {
    colCount = 2
    *colRatio = 80|20*
    rowCount = 3
    rows {
        1 {
            columns {
                1 {
                    name = Banner 1
                    colPos = 8
                }
                2 {
                    name = Banner 2
                    rowspan = 3
                    colPos = 9
                }
            }
        }
        2 {
            columns {
                1 {
                    name = Header
                    colPos = 3
                }
            }
        }
        3 {
            columns {
                1 {
                    name = Content
                    colPos = 0
                }
            }
        }
    }
}

Files

backend_layout.JPG (16.3 KB) backend_layout.JPG Uwe Jakobs, 2013-01-06 19:11
Actions

Also available in: Atom PDF