2017 © Pedro Peláez
 

neos-package neos-assetcollectionhelpers

Neos package that helps dealing with cache invalidation of AssetCollections used in content

image

visol/neos-assetcollectionhelpers

Neos package that helps dealing with cache invalidation of AssetCollections used in content

  • Monday, March 5, 2018
  • by visol
  • Repository
  • 4 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

AssetCollectionHelpers

This Neos package solves some problems when dealing with AssetCollections nodes., (*1)

In Neos, it is possible to select any entity in the SelectBoxEditor. AssetCollections in Neos are entities and they are very useful if you want to provide file list or galleries without selecting each file manually., (*2)

The only problem is that the content cache is not aware of the following changes:, (*3)

  • An Asset of an AssetCollection is edited/deleted/replaced
  • An Asset is added to/removed from an AssetCollection

Therefore, if you e.g. upload a new Asset to an existing AssetCollection, your file list will still display only the files present when the cache was last built., (*4)

This package provides you with the necessary implementations to work around these problems., (*5)

Compatibility and Maintenance

This package is currently being maintained for the following versions:, (*6)

Neos Version Version Maintained
Neos 3.x 1.0 No
Neos 4.x 2.x Yes
Neos 5.x and above 3.x Yes

Example NodeType configuration

Use AssetCollection as in a SelectBoxEditor:, (*7)

'My.FoobarCom:Content.FileList':
  [...]
  properties:
    assetCollection:
      type: 'Neos\Media\Domain\Model\AssetCollection'
      ui:
        label: i18n
        inspector:
          group: 'resources'
          editor: 'Neos.Neos/Inspector/Editors/SelectBoxEditor'
          editorOptions:
            dataSourceIdentifier: visol-neos-assetcollections
        reloadIfChanged: true

Example fusion caching configuration

In Fusion, we add a cache tag for the given AssetCollection:, (*8)

prototype(My.FoobarCom:Content.FileList) < prototype(Neos.Neos:ContentComponent) {
    assetCollection = ${q(node).property('assetCollection')}
    @context.assetCollection = ${this.assetCollection}

    @cache {
        mode = 'cached'
        entryIdentifier {
            node = ${node}
        }
        entryTags {
            1 = ${'Node_' + node.identifier}
            2 = ${AssetCollection.Caching.assetCollectionTag(assetCollection)}
        }
    }

    [... configure output]
}

The package then monitors changes to assets and asset collections and flushes the cache of all nodes having the affected cache tag., (*9)

Credits

https://discuss.neos.io/t/guide-how-to-select-entities-in-the-inspector-neos-2-3-lts/1664, (*10)

visol digitale Dienstleistungen GmbH, www.visol.ch, (*11)

The Versions

05/03 2018

dev-master

9999999-dev

Neos package that helps dealing with cache invalidation of AssetCollections used in content

  Sources   Download

MIT

The Requires

 

05/03 2018

1.0.0

1.0.0.0

Neos package that helps dealing with cache invalidation of AssetCollections used in content

  Sources   Download

MIT

The Requires