CONTRANCE6: SPLIT SIMILAR BACKEND FIELDS WITH THE DATA-LEGEND ATTRIBUT

created: 21.11.2018 10:56

edited: 21.11.2018 11:25

back

/contrance/Plugin/View/Contents/edit.php

php
// Top Seiten
for ($i = 1; $i <= 6; $i++) {
    echo $this->AceForm->input(
        'site_'.$i.'_text',
        [
            'type'  => 'text',
            'label' => ['text' => __d('app', 'Buttontext')],
            'div'   => [
                'class'       => 'form-group',
                'data-legend' => 'Seite'.$i,
            ],
        ]
    );
    echo $this->AceForm->input(
        'site_'.$i.'_menu_id',
        [
            'type'         => 'autocomplete',
            'autocomplete' => ['url' => ['controller' => 'menus', 'plugin' => 'menus', 'action' => 'autocomplete']],
            'label'        => ['text' => __d('app', 'Menüpunkt')],
        ]
    );
    echo $this->AceForm->input(
        'site_'.$i.'_url',
        [
            'type'  => 'text',
            'label' => ['text' => __d('app', 'URL')],
            'help'  => __d('app', 'Muss mit https:// beginnen'),
        ]
    );
    echo $this->AceForm->input(
        'site_'.$i.'_external_target', [
            'type'  => 'checkbox',
            'label' => ['text' => __d('app', 'In neuem Fenster öffnen')],
        ]
    );
}

/contrance/webroot/css/mh.css

css
[data-legend^="Seite"]:before {
    content: attr(data-legend) !important;
    position: relative !important;
    display: block !important;
    width: auto;
    margin-top: 20px;
    height: 50px;
    font-size: 28px;
    text-align: center;
    font-weight: lighter;
    color: #2679b5;
    padding-top: 25px;
    padding-bottom: 60px;
    border-top: 1px solid #C5D0DC;
}