Flattened gallery in tx_news

Issue #24 closed
r4fx created an issue

Hello,

I'm looking for solution to display flattened gallery in tx_news single view based on selected parent folder, for now we need to select every single folder with images to display thumbnails with link to gallery, I would like to automate this, what I want to do is select only main folder (parent) which contains many subfolders, so I think option like "include subfolder" should do the job from editor view. In standard way when we inserting the plugin to the page this is called Flattened gallery.

Frans do you think that could be done?

Comments (7)

  1. Frans Saris repo owner

    With some adjustments to your news template displaying the sub album's should already be possible. Adding the switch so editors could enable/disable needs some programming.

    <f:if condition="{newsItem.relatedFsmediaalbums}">
        <h4>Related albums</h4>
        <div class="fs-media-gallery">
        <f:for each="{newsItem.relatedFsmediaalbums}" as="parentAlbum">
    
    
        <f:for each="{parentAlbum.albums}" as="mediaAlbum">
            <div class="thumb">
                <f:link.action pageUid="{settings.detail.fsmediaalbum.targetPid}" pluginName="Mediagallery" extensionName="FsMediaGallery" controller="MediaAlbum" arguments="{mediaAlbum : mediaAlbum}">
                    <f:image
                        image="{mediaAlbum.randomAsset}"
                        alt="{mediaAlbum.title}"
                        title="{mediaAlbum.title}"
                        height="{settings.detail.fsmediaalbum.thumb.width}{settings.detail.fsmediaalbum.thumb.resizeMode}"
                        width="{settings.detail.fsmediaalbum.thumb.height}{settings.detail.fsmediaalbum.thumb.resizeMode}"
                        class="img-responsive"
                    />
                    <div class="name">{mediaAlbum.title}</div>
                    <div class="description"><f:format.crop maxCharacters="17" append="&nbsp;...">{mediaAlbum.webdescription}</f:format.crop></div>
                </f:link.action>
            </div>
        </f:for>
    
    
        </f:for>
        </div>
    </f:if>
    
  2. r4fx reporter

    Thank you for an answer, i have tested your code, but unfortunately this doesn't work, because parentAlbum has no albums field, so the second each returns nothing. Is there possibility to know that selected album have subfolders?

  3. Frans Saris

    if the selected (parent)album has sub-albums these are available through {album.albums}. This is indeed no property of an album but Fluid calls the getAlbums() method of the MediaAlbum class.

  4. Log in to comment