I have found the case testing an extension. An image field (that was working in Joomla 3.4) is not working in 3.5.0rc4.
This is the button to choose an image for the image field.
$remoteUrl = 'index.php?option=com_media&view=images&tmpl=component&asset=com_myextension&author=' . JFactory::getUser()->id . '&fieldid=' . $idTag;
$buttonId = $idTag . '_btn';
JHtml::_('bootstrap.modal');
$control[] = '<a id="' . $buttonId . '" href="#' . $idTag . '_modal" role="button" class="btn" data-toggle="modal" title="' . JText::_('JSELECT') . '">' . JText::_('JSELECT') . '</a>';
$control[] = JHtmlBootstrap::renderModal(
$idTag . '_modal',
array(
'url' => $remoteUrl,
'title' => JText::_('JSELECT'),
'height' => '600px', 'width' => '500px')
);
Selected image file is inserted in the image field.
No action
3.5.0rc4
If Isis view override is removed, then the image selection works OK.
administrator/templates/isis/html/com_media/images/default.php
<button class="btn btn-success button-save-selected" type="button" <?php if (!$this->state->get('field.id')):?>onclick="ImageManager.onok();window.parent.jModalClose();window.parent.jQuery('.modal.in').modal('hide');"<?php endif;?> data-dismiss="modal"><?php echo JText::_('COM_MEDIA_INSERT') ?></button>
administrator/components/com_media/views/images/tmpl/default.php
<button class="btn btn-success button-save-selected" type="button" onclick="<?php if ($this->state->get('field.id')):?>window.parent.jInsertFieldValue(document.getElementById('f_url').value,'<?php echo $this->state->get('field.id');?>');<?php else:?>ImageManager.onok();<?php endif;?
@dgt41 ... I remember a related PR ...
Title |
|
Labels |
Added:
?
|
The button is the one on the modals footer or the one inside the modal?
The button inside the modal from media/images that calls the image insertion routine into the field.
Category | ⇒ | Media Manager |
Labels |
I cannot replicate this! @anibalsanchez is your browser's cache cleared? Which extension failed?
If Isis view override is removed, then the image selection works OK.
administrator/templates/isis/html/com_media/images/default.php
Yes i confirm this issue,
isis backend template has an template override file ...
administrator/templates/isis/html/com_media/images/default.php
but com_media component has:
administrator/components/com_media/views/images/tmpl/default.php
I have already made a workaround in my extension to load a copy of the component template file ...
JPATH_BASE.'/templates/'.$app->getTemplate().'/html/com_media/images/my_extensionname.php
but there must be several extensions with custom code,
[EDIT]
by using creating file: my_extensionname.php i am not breaking anything in isis template or in any other extension
@dgt41
you are right but ...
it is not an XML file not JForm !
I am calling inside media manager inside custom PHP code ...
similar as @anibalsanchez example
and i have seen 1 or 2 other extensions doing this
[EDIT]
which extensions are propably not updated yet
OK, now it makes sense. I will change the code to incorporate such cases
Status | New | ⇒ | Confirmed |
Labels |
@anibalsanchez @ggppdk @wilsonge This is one of those chicken-egg situation: providing the old JinsertImage() breaks the repeatable field
OK How exactly are you guys using this field. I know you say PHP - but I need more information to make a decision about b/c. Like honestly my gut is that JFormFields are designed to work through JForm - if you are using things outside of this then we don't offer b/c on that. But willing to study code if you guys feel you are "using" the API correctly :)
Ok, this is not a complete solution, but maybe duplicate
administrator/components/com_media/views/images/tmpl/default.php
as:
administrator/components/com_media/views/images/tmpl/default_legacy.php
And require that all extensions using custom code to call media manager will need to add to their URL:
&layout=default_legacy
But i think that there is 1 more problem here:
It means that if any site uses a different backend template that does not have an override like isis
then these will break ?
[EDIT]
i mean if template was to be changed like this then the change should have been inside the component and not via a template override
@wilsonge
Because i felt i was not using the API correctly
I am using JForm,
About my code:
// We will use the mootools based media manager
JHtml::_('behavior.framework', true);
// Load the modal behavior script.
JHtml::_('behavior.modal'/*, '.fc_image_field_mm_modal'*/);
// Include media field JS, detecting different version of Joomla
if( file_exists($path = JPATH_ROOT.'/media/media/js/mediafield-mootools.min.js') ) $media_js = 'media/mediafield-mootools.min.js';
else if( file_exists($path = JPATH_ROOT.'/media/media/js/mediafield.min.js') ) $media_js = 'media/mediafield.min.js';
else $media_js = 'media/mediafield.js';
JHtml::_('script', $media_js, $mootools_framework = true, $media_folder_relative_path = true, false, false, true);
// Tooltips for image path and image popup preview
JHtml::_('behavior.tooltip', '.hasTipImgpath', array('onShow' => 'jMediaRefreshImgpathTip'));
JHtml::_('behavior.tooltip', '.hasTipPreview', array('onShow' => 'jMediaRefreshPreviewTip'));
...
...
...
$mm_link = 'index.php?option=com_media&view=images&layout=default_fc&tmpl=component&asset=com_flexicontent&author=&fieldid=\'+mm_id+\'&folder=';
$select_existing = '
<div class="'.$input_grp_class.'">
<div class="media-preview '.$add_on_class.' ">
'.JHtml::tooltip($tooltip, $tooltip_options).'
</div>
<input type="text" name="'.$fieldname_n.'[existingname]" id="'.$mm_id.'" value="'.htmlspecialchars($img_path, ENT_COMPAT, 'UTF-8').'" readonly="readonly"
class="existingname input-xxlarge field-media-input hasTipImgpath" title="'.htmlspecialchars('<span id="TipImgpath"></span>', ENT_COMPAT, 'UTF-8').'" data-basepath="'.JUri::root().'"
/>
<a class="fc_image_field_mm_modal btn '.$tooltip_class.'" title="'.JText::_('FLEXI_SELECT_IMAGE').'" onclick="var mm_id=jQuery(this).parent().find(\'.existingname\').attr(\'id\'); currElement'.$field->id.'=mm_id; SqueezeBox.open(\''.$mm_link.'\', {size:{x: ((screen.width-120) > 1360 ? 1360 : (screen.width-120)), y: ((screen.height-220) > 800 ? 800 : (screen.height-220))}, handler: \'iframe\', onClose: function() { incrementValCnt'.$field->id.'(); } }); return false;">
'.JText::_('FLEXI_SELECT').'
</a>
<a class="btn '.$tooltip_class.'" href="javascript:;" title="'.JText::_('FLEXI_CLEAR').'" onclick="var mm_id=jQuery(this).parent().find(\'.existingname\').attr(\'id\'); clearField'.$field->id.'(this); jInsertFieldValue(\'\', mm_id); return false;" >
<i class="icon-remove"></i>
</a>
</div>
';
In my case, the original button from media/images fixes the issue.
With your changes in the insert button
And now i remember that indeed that was the problem, the changes in the insert button, not the use of bootstrap modal (sorry i recalled wrong)
So this seems to be backwards compatible.
Does your change break the repeatable field ?
Closed as we have a PR for testing #9466
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-03-18 11:57:59 |
Closed_By | ⇒ | brianteeman | |
Labels |
Labels |
Labels |
Removed:
?
|
Hi,
I am also facing the same problem with JA Platon theme. It was working fine with Joomla 3.4. The issue cause after Joomla Version update. Kindly help me.
@nareshvida you should check with the maker if the template for an update
@dgt41 I think this is one for you