inspiredminds / contao-turbo-helper
This extension helps with the usage of Turbo in Contao applications.
                                    Fund package maintenance!
                                                                            
                                                                                                                                        fritzmg
                                                                                    
                                                                
Installs: 1 137
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:contao-bundle
pkg:composer/inspiredminds/contao-turbo-helper
Requires
- php: >=8.2
 - contao/core-bundle: ^4.13 || ^5.0
 - symfony/config: ^5.4 || ^6.3 || ^7.3
 - symfony/dependency-injection: ^5.4 || ^6.3 || ^7.3
 - symfony/http-kernel: ^5.4 || ^6.3 || ^7.3
 
Requires (Dev)
- contao/easy-coding-standard: ^6.0
 - contao/rector: ^1.0
 
README
Contao Turbo Helper
This extension helps with the usage of Turbo in Contao applications.
- It provides a Turbo Frame wrapper as content elements.
 - It forces the status code to 422 Unprocessable Entity when a Contao form does not validate.
 - It forces a JavaScript load of a form's target URL, in case it would redirect to a URL outside the current domain.
 
Streams
You can also create streams within your legacy Contao PHP templates:
<!-- templates/mod_newslist.html5 --> <?php $this->startTurboStream(); ?> <turbo-stream action="append" target="mod-newslist-articles-<?= $this->id ?>"> <template><?= implode('', $this->articles) ?></template> </turbo-stream> <turbo-stream action="update" target="mod-newslist-pagination-<?= $this->id ?>"> <template><?= $this->pagination ?></template> </turbo-stream> <?php $this->endTurboStream(); ?> <?php $this->extend('mod_newslist'); ?> <?php $this->block('content'); ?> <?php if (empty($this->articles)): ?> <p class="empty"><?= $this->empty ?></p> <?php else: ?> <div id="mod-newslist-articles-<?= $this->id ?>"> <?= implode('', $this->articles) ?> </div> <div id="mod-newslist-pagination-<?= $this->id ?>"> <?= $this->pagination ?> </div> <?php endif; ?> <?php $this->endblock(); ?>
The server will then respond with these streams if there was a request with Accept: text/vnd.turbo-stream.html (e.g.
through a link with data-turbo-stream).