Skip to content

Commit

Permalink
Warned when the resource type media is used in the block layout brows…
Browse files Browse the repository at this point in the history
…e preview.
  • Loading branch information
Daniel-KM committed Sep 16, 2018
1 parent a474161 commit d6ae1ea
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions application/src/Site/BlockLayout/BrowsePreview.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function form(PhpRenderer $view, SiteRepresentation $site,
'type' => Element\Text::class,
'options' => [
'label' => 'Link text', // @translate
'info' => 'Text for link to full browse view, if any.', // @translate
'info' => 'Text for link to full browse view, if any. There is no link for media.', // @translate
],
]);

Expand Down Expand Up @@ -117,11 +117,13 @@ public function render(PhpRenderer $view, SitePageBlockRepresentation $block)
'media' => 'media',
];

// There is no list of media in public views.
$linkText = $resourceType === 'media' ? '' : $block->dataValue('link-text');
return $view->partial('common/block-layout/browse-preview', [
'resourceType' => $resourceTypes[$resourceType],
'resources' => $resources,
'heading' => $block->dataValue('heading'),
'linkText' => $block->dataValue('link-text'),
'linkText' => $linkText,
'query' => $originalQuery,
]);
}
Expand Down

0 comments on commit d6ae1ea

Please sign in to comment.