devp-eu/tmcms-module-gallery

Module Gallery for TMCms

dev-master 2018-09-02 18:36 UTC

This package is not auto-updated.

Last update: 2024-05-12 21:46:08 UTC


README

Module Gallery for TMCms

Module adds image gallery functionality as separate module AND as possibility to auto-create internal galleries for every Entity presented in any other module, e.g. Products, Articles, etc.

Usage for Entities

Create Gallery column

// Data for table
...
$product = new ProductEntity();
$entity_class = strtolower(Converter::classWithNamespaceToUnqualifiedShort($product));

$images = new ImageEntityRepository();
$images->setWhereItemType($entity_class);
...
// Table Helper
...
'columns' => [
  ...,
  'gallery'    => [
    'type'   => 'gallery',
    'images' => $images,
  ],
  ...,
],
...

And add method for managing gallery images in CmsClass

...
public function images()
{
  $product_id = ... // whatever you need
  $product = new ProductEntity($product_id);
  echo ModuleGallery::getViewForCmsModules(product);
}