?
avatar astridx
astridx
22 Feb 2020

Steps to reproduce the issue

  1. Activate Language Filter plugin.

  2. Install a second language.
    Languages  Installed  Site    test   Administration(1)

  3. Create aContent Languagefor the in 2 installed language
    Languages  Content   test   Administration

  4. Comment out the line for testing

    <?php echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?>

  5. See, that you can create associations in the component com_contact.
    Articles  Edit   test   Administration(2)

  6. Try to create an association via Multilingual Associations Component.

Expected result

Side by Side in Multilingual Associations Component view is not working properly

Multilingual Associations  Edit Associations  Articles   Articles    test   Administration

Actual result

Side by Side ended up in a endless loop.

Additional comments

I am not sure if it is a Bug. But I think, that other third party extensions will run into this issue, too.

I was able to isolate the problem.

$(this).contents().find('#jform_id').val() is undefined in this line:

if ($(this).contents().find('#jform_id').val() !== this.getAttribute('data-id')) {

If you do not use the layout joomla.edit.publishingdata. Because in this layout a hidden field is set, that is used in the JavaScript File for the Side by Side view. So all extensions at one point must also set this field.

<input type="hidden" readonly id="jform_id" name="jform_id" value="<?php echo (int) $this->item->id ?>">

If my idea is correct, we should add this to this documentation: https://docs.joomla.org/J3.x:Multilingual_Associations/SidebySide

avatar astridx astridx - open - 22 Feb 2020
avatar joomla-cms-bot joomla-cms-bot - change - 22 Feb 2020
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 22 Feb 2020
avatar astridx astridx - change - 22 Feb 2020
The description was changed
avatar astridx astridx - edited - 22 Feb 2020
avatar astridx astridx - change - 22 Feb 2020
The description was changed
avatar astridx astridx - edited - 22 Feb 2020
avatar astridx astridx - change - 22 Feb 2020
The description was changed
avatar astridx astridx - edited - 22 Feb 2020
avatar astridx astridx - change - 22 Feb 2020
The description was changed
avatar astridx astridx - edited - 22 Feb 2020
avatar Quy Quy - change - 23 Feb 2020
Title
[4.[4.0] Multilingual Associations Side by Side view is not working properly in a custom component
[4.0] Multilingual Associations Side by Side view is not working properly in a custom component
avatar Quy Quy - edited - 23 Feb 2020
avatar infograf768
infograf768 - comment - 24 Feb 2020

We have a specific code in core components for articles:

<?php // Creating 'id' hiddenField to cope with com_associations sidebyside loop ?>
		<?php if ($params->get('show_publishing_options', 1) == 0) : ?>
			<?php $hidden_fields = $this->form->getInput('id'); ?>
			<div class="hidden"><?php echo $hidden_fields; ?></div>
		<?php endif; ?>

This is only due to the specific articles parameter show_publishing_options.
I do not think we use that for other core components.

avatar astridx
astridx - comment - 24 Feb 2020

@infograf768 I do not think we use that for other core components.

Thank you very much for looking.

It is the same with com_contact:

<?php echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?>
and com_newsfeeds:
<?php echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?>

I want to put it differently
If you install the my com_foo component https://github.com/astridx/boilerplate/releases/tag/v1.0.0 and you do not use the layout, I mean, you delete this line:
https://github.com/astridx/boilerplate/blob/8068f3e4349207f759a567d1e2331c592142fb6c/src/administrator/components/com_foos/tmpl/foo/edit.php#L77

Then you run int this issue.

I encountered this problem when I prepared this component for use in Joomla version 4 (from Joomla version 3).

Am I missing something or is it likely that others will encounter this problem and we could avoid it?

avatar SharkyKZ
SharkyKZ - comment - 24 Feb 2020

You just need to render the ID field, not necessarily using joomla.edit.publishingdata layout. If your fields are using different names, that's another issue. The selectors in the script would have to be configurable.

avatar astridx
astridx - comment - 24 Feb 2020

@SharkyKZ The selectors in the script would have to be configurable.

What do you mean exactly?
Can I configure the selectors (I don't see that) or should the script be changed so that the selectors could be configured?
Do you think this is an issue and I should leave this open here.

avatar SharkyKZ
SharkyKZ - comment - 25 Feb 2020

The script could be changed to support this, if needed.

avatar infograf768
infograf768 - comment - 25 Feb 2020

@astridx
What I meant is that com_content needs to define this id hidden field, but not com_contact for example.
To test, I commented <?php //echo LayoutHelper::render('joomla.edit.publishingdata', $this); ?> in contact edit and I had no loop issue in multilingual component.

avatar astridx
astridx - comment - 1 Mar 2020

@infograf768 I have this issue in all components.
But as I am not sure if this is a bug I close this issue. I put a link to this issue on the end of the doc page https://docs.joomla.org/J3.x:Multilingual_Associations/Developers

avatar astridx astridx - change - 1 Mar 2020
Status New Closed
Closed_Date 0000-00-00 00:00:00 2020-03-01 21:56:56
Closed_By astridx
avatar astridx astridx - close - 1 Mar 2020

Add a Comment

Login with GitHub to post a comment