Skip to content

Commit

Permalink
Do not add escaped lightbox group identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
markocupic committed Nov 16, 2023
1 parent 5810926 commit e6e7fa6
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Auto detect text files and perform LF normalization
* text=auto
* text eol=lf

#* text=auto

# Custom for Visual Studio
*.cs diff=csharp
Expand Down
4 changes: 3 additions & 1 deletion contao/templates/component/_album.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<div{{ attrs(album_inner_attributes|default).addClass('gc-album-list-inner') }}>
{% block album_figure %}
<div{{ attrs(album_figure_attributes|default).addClass('gc-album-list-figure') }}>
{{ contao_figure(album.figureUuid, album.figureSize, album.figureOptions) }}
{% include "@Contao/component/_figure.html.twig" with {
figure: figure(album.figureUuid, album.figureSize, album.figureOptions)
} %}
</div>
{% endblock %}

Expand Down
4 changes: 3 additions & 1 deletion contao/templates/component/_album_detail_view.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@
<{{ album_detail_picture_list_tag_name }}{{ attrs(album_detail_picture_list_attributes|default).addClass('gc-album-detail-picture-list') }}>
{% for picture in arrPictures %}
<{{ album_detail_picture_list_item_tag_name }}{{ attrs(album_detail_picture_list_item_attributes|default).addClass('gc-album-detail-picture-list-item') }}>
{{ contao_figure(picture.figureUuid, picture.figureSize, picture.figureOptions) }}
{% include "@Contao/component/_figure.html.twig" with {
figure: figure(picture.figureUuid, picture.figureSize, picture.figureOptions)
} %}
</{{ album_detail_picture_list_item_tag_name }}>
{% endfor %}
</{{ album_detail_picture_list_tag_name }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ protected function addAlbumPicturesToTemplate(GalleryCreatorAlbumsModel $albumMo
}

if (null !== ($picturesModel = GalleryCreatorPicturesModel::findByPk($rowPicture['id']))) {
if($picturesModel->uuid && $this->pictureUtil->pictureExists($picturesModel))
{
if ($picturesModel->uuid && $this->pictureUtil->pictureExists($picturesModel)) {
// Prevent overriding items with same basename
$arrPictures[$basename.'-id-'.$rowPicture['id']] = $this->pictureUtil->getPictureData($picturesModel, $contentModel);
}
Expand Down
3 changes: 1 addition & 2 deletions src/DataContainer/GalleryCreatorAlbums.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
use Markocupic\GalleryCreatorBundle\Revise\ReviseAlbumDatabase;
use Markocupic\GalleryCreatorBundle\Security\GalleryCreatorAlbumPermissions;
use Markocupic\GalleryCreatorBundle\Util\FileUtil;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\Finder\Finder;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Environment as TwigEnvironment;
use Twig\Error\LoaderError;
Expand All @@ -71,7 +71,6 @@ class GalleryCreatorAlbums
private Adapter $system;
private Adapter $config;


/**
* @throws DoctrineDBALException
* @throws Exception
Expand Down
2 changes: 1 addition & 1 deletion src/DataContainer/GalleryCreatorPictures.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
use Markocupic\GalleryCreatorBundle\Model\GalleryCreatorPicturesModel;
use Markocupic\GalleryCreatorBundle\Security\GalleryCreatorAlbumPermissions;
use Markocupic\GalleryCreatorBundle\Util\FileUtil;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Contracts\Translation\TranslatorInterface;
use Twig\Environment as TwigEnvironment;

Expand Down
5 changes: 2 additions & 3 deletions src/Util/PictureUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,14 @@ public function getPictureData(GalleryCreatorPicturesModel $pictureModel, Conten
'localMediaSrc' => $localMediaSrc,
'socialMediaSrc' => $socialMediaSrc,
'exif' => $this->galleryCreatorReadExifMetaData ? $this->getExif(new File($filesModel->path)) : [],
'singleImageUrl' => StringUtil::ampersand($objPage->getFrontendUrl((Config::get('useAutoItem') ? '/' : '/items/').Input::get('items').'/img/'.$filesModel->name, $objPage->language)),
'singleImageUrl' => StringUtil::ampersand($objPage->getFrontendUrl((Config::get('useAutoItem') ? '/' : '/items/').Input::get('items').'/img/'.$filesModel->name)),
'figureUuid' => $pictureModel->addCustomThumb && $pictureModel->customThumb ? $pictureModel->customThumb : $filesModel->uuid,
'figureSize' => !empty($arrSize) ? $arrSize : null,
'figureHref' => $href,
'figureOptions' => [
'metadata' => new Metadata($arrMeta),
'enableLightbox' => (bool) $contentElementModel->gcFullSize,
'lightboxGroupIdentifier' => sprintf('data-lightbox="lb%s"', $pictureModel->pid),
//'lightboxSize' => '_big_size',
'lightboxGroupIdentifier' => sprintf('lb%s', $pictureModel->pid),
'linkHref' => $href,
],
];
Expand Down
2 changes: 1 addition & 1 deletion src/Util/SecurityUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use Contao\FrontendUser;
use Contao\StringUtil;
use Markocupic\GalleryCreatorBundle\Model\GalleryCreatorAlbumsModel;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\RequestStack;

class SecurityUtil
{
Expand Down

0 comments on commit e6e7fa6

Please sign in to comment.