Skip to content

Commit

Permalink
View homepage in Editor even if viewless
Browse files Browse the repository at this point in the history
  • Loading branch information
I-Valchev authored and bobdenotter committed Nov 8, 2020
1 parent c9540a5 commit fdb266d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Twig/ContentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,11 @@ public function allowTwig(Environment $env, Content $content): void
public function getLink($contentOrTaxonomy, bool $canonical = false, ?string $locale = null): ?string
{
if ($contentOrTaxonomy instanceof Content) {
if ($contentOrTaxonomy->getId() === null || $contentOrTaxonomy->getDefinition()->get('viewless')) {
if ($contentOrTaxonomy->getId() === null) {
return null;
}

if ($contentOrTaxonomy->getDefinition()->get('viewless') && $this->getSpecialFeature($contentOrTaxonomy) !== 'homepage') {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion templates/content/_buttons.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ macro.button('action.save', 'fa-save', 'success', {'type': 'submit', 'form': 'editcontent', 'data-patience': 'virtue', 'name': 'save'}) }}

{% if record.id %}
{% if not record.definition.get('viewless') %}
{% if record|feature == 'homepage' or not record.definition.get('viewless') %}
<div class="btn-group">
{{ macro.button(
'action.preview',
Expand Down

0 comments on commit fdb266d

Please sign in to comment.