-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the
attr()
method in templates (see #7218)
Description ----------- See https://github.com/contao/contao/pull/7209/files#r1598224759 <img width="775" alt="" src="https://github.com/contao/contao/assets/1192057/00e4aad4-2ea5-423f-8d80-c917b2b67641"> The content element templates belong to deprecated legacy elements, so I‘m not sure if we want to update these, too? Commits ------- b8eaf2d Use the `attr()` method in templates 01e85a5 Allow overwriting the wrapper attributes in child templates 3f428e9 Reduce duplicate code 9dcc427 Unify HtmlAttributes usage in legacy templates (see #13) 3f4899c Clean up 3e27bb5 Move the $this->extend() call to the top a62e072 Adjust the ce_teaser.html5 template bf5e8ee Adjust the info_default.html5 template Co-authored-by: fritzmg <fmg@inspiredminds.at>
- Loading branch information
Showing
24 changed files
with
255 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
<?php | ||
|
||
<div class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>> | ||
$this->wrapperAttributes = $this | ||
->attr($this->cssID) | ||
->addClass([$this->class, 'block']) | ||
->addStyle($this->style) | ||
->mergeWith($this->wrapperAttributes) | ||
; | ||
|
||
<?php $this->block('headline'); ?> | ||
<?php if ($this->headline): ?> | ||
<<?= $this->hl ?>><?= $this->headline ?></<?= $this->hl ?>> | ||
<?php endif; ?> | ||
<?php $this->endblock(); ?> | ||
?> | ||
|
||
<?php $this->block('content'); ?> | ||
<?php $this->endblock(); ?> | ||
<?php $this->block('wrapper'); ?> | ||
<div<?= $this->wrapperAttributes ?>> | ||
|
||
</div> | ||
<?php $this->block('headline'); ?> | ||
<?php if ($this->headline): ?> | ||
<<?= $this->hl ?>><?= $this->headline ?></<?= $this->hl ?>> | ||
<?php endif; ?> | ||
<?php $this->endblock(); ?> | ||
|
||
<?php $this->block('content'); ?> | ||
<?php $this->endblock(); ?> | ||
|
||
</div> | ||
<?php $this->endblock(); ?> |
20 changes: 6 additions & 14 deletions
20
core-bundle/contao/templates/block/block_unsearchable.html5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
<?php $this->extend('block_searchable') ?> | ||
|
||
<!-- indexer::stop --> | ||
<div class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>> | ||
|
||
<?php $this->block('headline'); ?> | ||
<?php if ($this->headline): ?> | ||
<<?= $this->hl ?>><?= $this->headline ?></<?= $this->hl ?>> | ||
<?php endif; ?> | ||
<?php $this->endblock(); ?> | ||
|
||
<?php $this->block('content'); ?> | ||
<?php $this->endblock(); ?> | ||
|
||
</div> | ||
<!-- indexer::continue --> | ||
<?php $this->block('wrapper'); ?> | ||
<!-- indexer::stop --> | ||
<?php $this->parent(); ?> | ||
<!-- indexer::continue --> | ||
<?php $this->endblock(); ?> |
12 changes: 11 additions & 1 deletion
12
core-bundle/contao/templates/elements/ce_accordionSingle.html5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
core-bundle/contao/templates/elements/ce_accordionStart.html5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
<?php | ||
|
||
<<?= $this->hl ?> class="<?= $this->class ?>"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>> | ||
$this->wrapperAttributes = $this | ||
->attr($this->cssID) | ||
->addClass($this->class) | ||
->addStyle($this->style) | ||
->mergeWith($this->wrapperAttributes) | ||
; | ||
|
||
?> | ||
|
||
<<?= $this->hl ?><?= $this->wrapperAttributes ?>> | ||
<?= $this->headline ?> | ||
</<?= $this->hl ?>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
<?php $this->extend('block_searchable'); ?> | ||
|
||
<div class="<?= $this->class ?> ce_text block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>> | ||
<?php | ||
|
||
<?php if ($this->headline): ?> | ||
<h1><?= $this->headline ?></h1> | ||
<?php endif; ?> | ||
$this->wrapperAttributes = $this | ||
->attr() | ||
->addClass('ce_text') | ||
->mergeWith($this->wrapperAttributes) | ||
; | ||
|
||
<?= $this->text ?> | ||
$this->hl = 'h1'; | ||
|
||
?> | ||
|
||
<?php $this->block('content'); ?> | ||
|
||
<?= $this->text ?> | ||
<p class="more"><a href="<?= $this->href ?>" title="<?= $this->readMore ?>"><?= $this->more ?><span class="invisible"> <?= $this->headline ?></span></a></p> | ||
|
||
</div> | ||
<?php $this->endblock(); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
<?php | ||
|
||
$this->wrapperAttributes = $this | ||
->attr($this->cssID) | ||
->addClass([$this->class, 'block']) | ||
->addStyle($this->style) | ||
->mergeWith($this->wrapperAttributes) | ||
; | ||
|
||
?> | ||
|
||
<!-- indexer::stop --> | ||
<div class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>> | ||
<div<?= $this->wrapperAttributes ?>> | ||
<a href="<?= $this->request ?>#top" title="<?= $this->title ?>"><?= $this->label ?></a> | ||
</div> | ||
<!-- indexer::continue --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
<?php | ||
|
||
<div class="<?= $this->prefix ?> explanation<?php if ($this->class): ?> <?= $this->class ?><?php endif; ?>"> | ||
$this->wrapperAttributes = $this | ||
->attr() | ||
->addClass([$this->prefix, 'explanation', $this->class]) | ||
->mergeWith($this->wrapperAttributes) | ||
; | ||
|
||
?> | ||
|
||
<div<?= $this->wrapperAttributes ?>> | ||
<?= $this->cspInlineStyles($this->generate()) ?> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.