namespace [vendor]\[module]\Block\Adminhtml\Grid\Helper\Form;
use Magento\Framework\Registry;
use Magento\Catalog\Model\Product;
use Magento\Eav\Model\Entity\Attribute;
use Magento\Catalog\Api\Data\ProductInterface;
class Gallery extends \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery
{
/**
* @var here you set your ui form
*/
protected $formName = 'sample_form';
}
namespace [vendor]\[module]\Block\Adminhtml\Grid\Helper\Form\Gallery;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Backend\Block\Media\Uploader;
use Magento\Framework\View\Element\AbstractBlock;
use Magento\Framework\App\Filesystem\DirectoryList;
class Content extends \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content
{
protected function _prepareLayout()
{
$this->addChild('uploader', 'Magento\Backend\Block\Media\Uploader');
$a = $this->getUploader()->getConfig()->setUrl(
$this->_urlBuilder->addSessionParam()->getUrl('[vendor]/grid_gallery/upload')/* here set you upload Controller */
)->setFileField(
'image'
)->setFilters(
[
'images' => [
'label' => __('Images (.gif, .jpg, .png)'),
'files' => ['*.gif', '*.jpg', '*.jpeg', '*.png'],
],
]
);
}
public function getImageTypes()
{
return '[]';
}
public function getMediaAttributes()
{
return '[]';
}
}
Note :- you should extends properly above both blocks
4) Create template
You should copy gallery.phtml form vendor/magento/module-product-video/view/adminhtml/templates/helper/gallery.phtml
and modified it as par your requirement and pest in your module [vendor]/[module]/view/adminhtml/templates/helper/gallery.phtml
Please let me know in comment if you need any help
Best Answer
Finally i got the answer
I refer this module and implement in my custom module
Find below useful code :
following below steps
1) create layout.xml
[vendor]/[module]/operation/view/adminhtml/layout/layout_edit.xml
2) Create helper block
[vendor]/[module]/Block/Adminhtml/Grid/Helper/Form/Gallery.php
3) Create helper form block
[vendor]\[module]\Block\Adminhtml\Grid\Helper\Form\Gallery\Content.php
Note :- you should extends properly above both blocks
4) Create template
You should copy gallery.phtml form
vendor/magento/module-product-video/view/adminhtml/templates/helper/gallery.phtml
and modified it as par your requirement and pest in your module[vendor]/[module]/view/adminhtml/templates/helper/gallery.phtml
Please let me know in comment if you need any help