Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically close wrapper elements #47

Open
ausi opened this issue Jun 26, 2015 · 9 comments
Open

Automatically close wrapper elements #47

ausi opened this issue Jun 26, 2015 · 9 comments
Assignees

Comments

@ausi
Copy link
Member

ausi commented Jun 26, 2015

If possible.

@ausi ausi self-assigned this Jun 26, 2015
@stefanschleich
Copy link

I'd like to see this, too 👍

@rustykowski
Copy link

this would be perfect for usability. 👍

@mariaj
Copy link

mariaj commented Oct 28, 2019

I have written a small local bundle which does the job. The configuration is done in the config file of the custom element by just adding wrapperClose:

... 'wrapper' => array('type' => 'start'), 'wrapperClose' => 'rsce_wrapper_stop', ...

It would be nice, if the feature could be integrated into the next version.

AutoWrapperClose.zip

@ngdot
Copy link

ngdot commented Oct 29, 2019

I have written a small local bundle which does the job. The configuration is done in the config file of the custom element by just adding wrapperClose:

... 'wrapper' => array('type' => 'start'), 'wrapperClose' => 'rsce_wrapper_stop', ...

It would be nice, if the feature could be integrated into the next version.

AutoWrapperClose.zip

How can I use it in the managed version of contao?

@mariaj
Copy link

mariaj commented Nov 1, 2019

AutoWrapperClose_v2.zip

I've updated the file. Now it contains the ContaoManagerPlugin.php to register the local bundle and also creates the closing wrapper when copying a single start wrapper. Just extract the zip file into your contao root folder and add the following lines to your composer.json file:

"autoload": {
    "classmap": [
        "app/ContaoManagerPlugin.php"
    ],
    "psr-4": {
        "iq2\\CEAutoWrapperCloseBundle\\": "src/iq2/CEAutoWrapperCloseBundle/"
    }
}

@mj1985
Copy link

mj1985 commented Jan 14, 2020

Hey @mariaj
do I need to add something? I testet the v2 in a managed contao and the wrapper_end won't be added automatically.
I already cleared all caches and reloaded the composer class loader.

My start-element:

<?php
return [
    'label' => [ 'Hervorhebung mit Hintergrundbild Anfang', ''],
    'types' => ['content'],
    'contentCategory' => 'Gruppierung',
    'standardFields' => ['cssID'],
    'wrapper' => [
        'type' => 'start'
    ],
    'fields' => [...]
]

My end-element:

 <?php

return [
    'label' => [ 'Hervorhebung mit Hintergrundbild Ende', ''],
    'types' => ['content'],
    'contentCategory' => 'Gruppierung',
    'standardFields' => ['cssID'],
    'wrapper' => [
        'type' => 'close'
    ]
]; 

@mariaj
Copy link

mariaj commented Jan 15, 2020

Hello mj1985,
you have to add the wrapperClose setting to your start-element config file to link the two elements. If the name of the end-element is 'rsce_wrapper_end', it should look like this:

<?php
return [
    'label' => [ 'Hervorhebung mit Hintergrundbild Anfang', ''],
    'types' => ['content'],
    'contentCategory' => 'Gruppierung',
    'standardFields' => ['cssID'],
    'wrapper' => [
        'type' => 'start'
    ],
    'wrapperClose' => 'rsce_wrapper_end',
    'fields' => [...]
]

hope I could help :)

I also have a new version, where I updated the calcuation of the sorting field:
AutoWrapperClose_v2.1.zip

Additional Information:
To create a permanent link between the elements, you can look at this: https://community.contao.org/de/showthread.php?74808-Variable-aus-Wrapper-Start-in-Wrapper-Stop-verwenden&p=513862&viewfull=1#post513862
In this example, you can automatically change the data of the end-element dependent on the data of the start-element.

@jankout

This comment was marked as off-topic.

@ausi

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants