Categories
CMS Development Joomla

Joomla 4 alpha display modal with insert image button

To whom it may concern:
I am developing a custom module in joomla 4 alpha, using bootstarp render modal window so that the user of component will assign images from media in joomla back end to extension gallery. In joomla 3.x there is insert and close button when modal window comes up. In Joomla 4 there is not or I am missing something:

$html .= JHtmlBootstrap::renderModal(‘myModal’, array(‘url’ => Uri::root().
‘administrator/index.php?option=com_media&tmpl=component&
e_name=myslideimgname&asset=com_modules&author=&
path=’ . ‘&’ . JSession::getFormToken() . ‘=1″‘,
‘width’ => ‘620px’, ‘height’ => ‘390px’));
In joomla 3.x there is view=images in which the two buttons were added in its layout, in joomla 4 alpha there is not such view, only file and media views. The way around this problem is to make user create a folder in images folder of joomla and add images there then read those images in layout of extension from the folder, yet If there is a solution to add insert button, I would rather employ it. Kian William Nowrouzian

One reply on “Joomla 4 alpha display modal with insert image button”

To help those who may experience the same thing I did I am sending this post:(duties prevented me from posting sooner)
First, best way is the one I referred in my question, making user of the extension create a folder, upload related images there, then in layout you can get the folder name and using JFile and JFolder you can place all files in an array and show them in gallery. But the other way I employed :
I included related libraries in the images view of com_media of J3.x in the modal page of my extension as external libraries, also I added a select button in the footer of modal with ImageManager.onok(), … in its click event.
Employing jQuery I added another ImageManager.populatefields() to href of select buttons of com_media image items,
then after save those href changes in select buttons of com_media shall be removed by jquery again to leave com_media as core component of Joomla quite intact.
If I used vue , I believe, there will be no need for these external libs but from scratch I used jquery.

Leave a Reply

Your email address will not be published. Required fields are marked *