1

I am developing a custom module in Joomla4 alpha, using a bootstrap rendered modal window so that the user of the component will assign images from media in the Joomla back end to the extension gallery.

In Joomla3.x, there are insert and close buttons when the modal window comes up.

In Joomla4, 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 Joomla3.x, there is view=images in which the two buttons were added in its layout, in Joomla4 alpha there is not such a view, only file and media views.

The way around this problem is to make the user create a folder in the images folder of Joomla, add images there, then read those images in the layout of the extension from the folder.

However, if there is a solution to add the insert button, I would rather employ it.

12
  • Your very long url value reminded me to ask this question. Please consider adopting http_build_query() to improve stability and readability. This will help to prevent typos (like " at the end). Commented Jan 13, 2020 at 14:01
  • This is the example to mention the situation, In my extension I employed HTMLHelper::_('bootstrap.renderModal', '', $params), joomla CMS will take care of it. Commented Jan 14, 2020 at 8:00
  • My claim is based on more than 350 custom extensions I analyzed after download from Joomla Extension Directory and in none of them any developer employed http_build_query(). This is a pure PHP function, the phylosophy of a CMS is to handle many functionalities including security. In some extensions in folder model parts of the component extension I observed that, yet in extensions which create modals , I have never seen any developer employ http_build_query() while assigning a url to $params['url'], it is the way as it is. You can conclude the same result if you like. Commented Jan 14, 2020 at 15:31
  • The fact that many Joomla extention developers do not call upon http_build_query() is 1. not a surprise to me, 2. likely due to so many Joomla devs being predisposed to "copy-pasting what has worked before", 3. probably because they are unaware that the function exists. Just because lots of people in a demographic aren't doing something, doesn't mean that something shouldn't be done. I am here to inform and educate ...and receive help when I need it. Commented Jan 14, 2020 at 22:22
  • If you hid my response, I shall conculde you read it, it was too long for comment part. That is enough for me. Commented Jan 16, 2020 at 5:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.