Provides basic image gallery functionality to a Silverstripe site.
Designed to provide a simple, fool-proof way for users to add image galleries to their website.
Applies Basic Image Gallery Extension
to a PhotoGalleryPage page type, and includes a PhotoGalleryHolder type.
- James Cocker (ssmodulesgithub@pswd.biz)
- Silverstripe 6
-
Install:
composer require purplespider/basic-galleries ^4 -
Visit yoursite.com/dev/build to rebuild the database.
-
Log in the CMS, and create a new Photo Gallery Holder page.
-
On the holder's Photo Galleries tab, click "Add new Image Gallery". Galleries are managed from this tab, using Lumberjack, rather than appearing in the site tree.
-
On a Photo Gallery Page, click on the Image Gallery tab, then click Bulk Upload to add images.
You can customise the CMS tab that the gallery appears on, as well as the title of the gallery displayed in the CMS:
HomePage:
extensions: - PurpleSpider\BasicGalleries\PhotoGalleryExtension
gallery-title: Image Gallery
gallery-cms-tab: Main
To list galleries in the site tree instead of on the holder's Photo Galleries tab:
---
Name: custom-basic-galleries
After: basic-galleries
---
PurpleSpider\BasicGalleries\PhotoGalleryPage:
show_in_sitetree: trueTo automatically delete image files when an image is deleted from a gallery:
---
Name: custom-basic-gallery-extension
After: basic-gallery-extension
---
PurpleSpider\BasicGalleryExtension\PhotoGalleryImage:
ondelete_delete_image_files: trueThis uses Delete Asset If Unused Extension to detect if the image is being used elsewhere on the site, and will only delete it if it isn't. There are caveats though, so check this module's readme, i.e. you might not want to use this on sites that have been upgraded from Silverstripe 3.
- 0.* = SilverStripe 3
- 1.* = Silverstripe 4
- 2.* = Silverstripe 4 (Uses newer version of
PhotoGalleryExtensionwith a polymorphic relation, so upgrading from 1 to 2 will break existing galleries.) - 3.* = Silverstripe 5
- 4.* = Silverstripe 6
- Change any references to the extension, e.g. if applied to the Homepage type, from
PurpleSpider\BasicGalleries\PhotoGalleryExtensiontoPurpleSpider\BasicGalleryExtension\PhotoGalleryExtension PurpleSpider\BasicGalleries\PhotoGalleryImageis nowPurpleSpider\BasicGalleryExtension\PhotoGalleryImage(in case you applied your own extension to it)- Run dev/build to update table names automatically (via legacy.yml)
- Complete "To v1" upgrade instructions, inc
dev/build - Run the
upgrade-basic-galleriestask to update database for existing galleries. On Silverstripe 6 that'ssake tasks:upgrade-basic-galleries, or visit/dev/tasks/upgrade-basic-galleries. - Until the task has run, existing galleries render empty with no error. It's safe to re-run.
- Nothing extra required, just change version to
^3.
- From v2 or v3, nothing extra required, just change version to
^4. - From v1, also follow the "to v2" notes above, as those database changes still need to happen:
sake db:build --flush, thensake tasks:upgrade-basic-galleries.
- Galleries move from the site tree to a Photo Galleries tab on their holder, which has an "Add new Image Gallery" button. No database changes. See "Keep Galleries in the Site Tree" to opt out.
- A site that registers
PurpleSpider\BasicGalleryExtension\CustomLumberjackon the holder itself can remove that, though leaving it does no harm.
