-
-
Notifications
You must be signed in to change notification settings - Fork 214
news_latest template does not check for addBefore #6731
Comments
Correct, the template does not support "add before" and "add after". Not every template supports every possible setting, e.g. the |
Of course, thus you would expect if one of the default templates does support the teaser image, it would also support all the properties for the teaser image. Just like you would expect the default template for the Text Content Element for example to do the same. |
I don't agree. And your change implies a BC break, so no way it's going to be applied. |
Yes, I am sorry, I forgot that the template I posted already had some other changes in it as well (I took it from another project of mine). The following would be a default news_latest template that does not break BC: <div class="layout_latest arc_<?php echo $this->archive->id; ?> block<?php echo $this->class; ?>">
<?php if ($this->hasMetaFields): ?>
<p class="info"><time datetime="<?php echo $this->datetime; ?>"><?php echo $this->date; ?></time> <?php echo $this->author; ?> <?php echo $this->commentCount; ?></p>
<?php endif; ?>
<?php if (!$this->addBefore): ?>
<h2><?php echo $this->linkHeadline; ?></h2>
<div class="teaser">
<?php echo $this->teaser; ?>
</div>
<?php endif; ?>
<?php if ($this->addImage): ?>
<figure class="image_container<?php echo $this->floatClass; ?>"<?php if ($this->margin || $this->float): ?> style="<?php echo trim($this->margin . $this->float); ?>"<?php endif; ?>>
<?php if ($this->href): ?>
<a href="<?php echo $this->href; ?>"<?php echo $this->attributes; ?> title="<?php echo $this->alt; ?>">
<?php endif; ?>
<img src="<?php echo $this->src; ?>"<?php echo $this->imgSize; ?> alt="<?php echo $this->alt; ?>">
<?php if ($this->href): ?>
</a>
<?php endif; ?>
<?php if ($this->caption): ?>
<figcaption class="caption" style="width:<?php echo $this->arrSize[0]; ?>px"><?php echo $this->caption; ?></figcaption>
<?php endif; ?>
</figure>
<?php endif; ?>
<?php if ($this->addBefore): ?>
<h2><?php echo $this->linkHeadline; ?></h2>
<div class="teaser">
<?php echo $this->teaser; ?>
</div>
<?php endif; ?>
<?php if ($this->text || $this->teaser): ?>
<p class="more"><?php echo $this->more; ?></p>
<?php endif; ?>
</div> Alternatively the meta fields could also be included into the addBefore condition. Including the addBefore property into the template itself should not create a BC break - |
Isn't it possible to have this reworked template as a regular feature in Contao for news_full, news_latest, etc.? Editors choose any image alignment and wonder why it's not working 🤷🏼♀️ |
Contao 4's |
Even though you are able to define the 4 different positions of the teaser image for a news entry (before, after, float left, float right), the news_latest template only considers the floating property, but not the addBefore property. Setting the image to 'after' has no effect in the default news_latest template.
A news_latest template, that actually considers this setting could look like this:
The text was updated successfully, but these errors were encountered: