Skip to content

Commit

Permalink
Merge branch 'feature/NSDPIMCORE-315' into 'v1'
Browse files Browse the repository at this point in the history
[NSDPIMCORE-315] thumbnail config: auto create and better name

See merge request NSD/p_pimcore/bundles/presentationbundle!6
  • Loading branch information
nehlsen committed Sep 26, 2022
2 parents 1d29098 + bafee49 commit 4500b64
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
namespace Neusta\Pimcore\PresentationBundle;

use Pimcore\Extension\Bundle\Installer\AbstractInstaller;
use Pimcore\Model\Asset\Image\Thumbnail;
use Pimcore\Model\Document\DocType;

class Installer extends AbstractInstaller
{
public function install(): void
{
$this->installDocumentTypes();
$this->installThumbnailConfiguration();
}

public function isInstalled(): bool
Expand Down Expand Up @@ -54,4 +56,15 @@ private function installDocumentType(array $typeDefinition): void
$model->setModificationDate($typeDefinition['modificationDate']);
$model->save();
}

private function installThumbnailConfiguration(): void
{
if (Thumbnail\Config::exists('pimcore-presentation-bundle-background-image')) {
return;
}

$thumbnailConfig = new Thumbnail\Config();
$thumbnailConfig->setName('pimcore-presentation-bundle-background-image');
$thumbnailConfig->save();
}
}
2 changes: 1 addition & 1 deletion Resources/views/Slide/_slide-frontend.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% set showSouthRight = pimcore_areablock("south-right-content").getCount() > 0 %}

{% if not pimcore_image("background-image").isEmpty() %}
{% set backgroundImageProperty = ' data-background-image="' ~ pimcore_image("background-image").thumbnail('dumb') ~ '"' %}
{% set backgroundImageProperty = ' data-background-image="' ~ pimcore_image("background-image").thumbnail('pimcore-presentation-bundle-background-image') ~ '"' %}
{% else %}
{% set backgroundImageProperty = '' %}
{% endif %}
Expand Down

0 comments on commit 4500b64

Please sign in to comment.