Comments (4)
I downloaded this extension and try test on my local.
This extension created Gallery Module on content section of M2 admin. It includes 2 sections: Galleries, and Images.
- Images: allow user create images with name, url, image, description, status (enable or disable)
- Gallery: allow user create galleries with name, status (enable or disable), collection (filter all images and user can select images to each galerry).
This extension is worked on Admin page. All data are stored on DB.
But i can't get galleries in front-end. :(
<?php
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$gallery = $_objectManager->get('DR\Gallery\Block\Gallery');
$a = $gallery->getGallery(); // Not work
echo $this->getGallery()->getId(); // Not Work
var_dump(count($a));
?>
from magento2-gallery.
I created 2 function.
File ../Block/Gallery.php
/**
* Get Gallery Collection (status = 1)
* @return mixed Gallery Collection
*/
public function getGalleryCollection()
{
$result = [];
$galleries = $this->galleryRepository->getAllGallery();
if (is_null($galleries) || count($galleries) <= 0) return [];
foreach($galleries as $gallery) {
$_gal = [
'id' => $gallery->getId(),
'name' => $gallery->getName(),
'status' => $gallery->getStatus(),
'images' => []
];
$images = $gallery->getImageCollection();
if (count($images) > 0) {
$_img = [];
foreach ($images as $image) {
if ($image->getStatus()) {
$img = [
'id' => $gallery->getId(),
'name' => $gallery->getName(),
'path' => $image->getPath()
];
array_push($_img, $img);
}
}
$_gal['images'] = $_img;
}
array_push($result, $_gal);
}
return $result;
}
and file ../Model/GalleryRepository.php
/**
* Get All Gallery with status = 1
* @return mixed
*/
public function getAllGallery() {
return $this->galleryCollectionFactory->create()
->addFieldToFilter("status", "1")
->setOrder('updated_at', 'DESC');
}
In Front - End
<?php
$_objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$gallery = $_objectManager->get('DR\Gallery\Block\Gallery');
$galleries = $gallery->getGalleryCollection();
?>
from magento2-gallery.
Sorry for the delay in getting back to you! @letunhatkong use the widget to display a gallery. @devdesco-ceo I will add the readme.md over the weekend.
from magento2-gallery.
Thank Daniel Rose for this extension.
from magento2-gallery.
Related Issues (10)
- Bug: Image Filter function in Gallerires Admin page HOT 1
- Filter not working Gallery Image Tab HOT 4
- Compiler Error
- Missing required argument $connectionName of DR\Gallery\Model\ResourceModel\Gallery HOT 4
- not supporting multi store/multi language
- Magento 2.2.3 error during compilation HOT 2
- Magento 2.2 adding an image to an existing gallery doesn't work
- Magento 2.2. Search functionality in Gallery section when selecting images for gallery is broken
- image not open in popup in magento 2.4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from magento2-gallery.