? Failure

User tests: Successful: Unsuccessful:

avatar david-bettondesign
david-bettondesign
20 Jun 2018

Pull Request for Issue #20810 .

Summary of Changes

Removed the return if no items found.

Testing Instructions

Create and publish an instance of mod_tags_similar.

Expected result

If the current item has items with related tags then these are shown, if not then an error message is shown "No matching tags."

Actual result

Documentation Changes Required

avatar david-bettondesign david-bettondesign - open - 20 Jun 2018
avatar david-bettondesign david-bettondesign - change - 20 Jun 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Jun 2018
Category Modules Front End
avatar brianteeman
brianteeman - comment - 20 Jun 2018

I think its personal preference if the module should not be displayed at all if there are no similar items or if it should be displayed as you suggest with that error message.

By changing it now you are potentially changing the display of every site using this module as soon as they update Joomla. So as a result I am personally not in favour of this change.

avatar mbabker
mbabker - comment - 20 Jun 2018

We shouldn't have these returns in the module's main file, that completely prevents loading a layout and rendering things at all, empty or otherwise. We can add a return to the layout file to keep the existing logic in place, that allows overrides to render something when empty also.

avatar brianteeman
brianteeman - comment - 20 Jun 2018

Sounds like a plan

avatar SharkyKZ
SharkyKZ - comment - 20 Jun 2018

Considering the layout has the code to display no results message, this patch is correct. But perhaps make it an option like in mod_tags_popular? Would address @brianteeman's concern and would be nice for consistency too.

<field
name="no_results_text"
type="radio"
label="MOD_TAGS_POPULAR_FIELD_NO_RESULTS_LABEL"
description="MOD_TAGS_POPULAR_FIELD_NO_RESULTS_DESC"
class="btn-group btn-group-yesno"
default="0"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>

if (!count($list) && !$params->get('no_results_text'))
{
return;
}

avatar SharkyKZ
SharkyKZ - comment - 20 Jun 2018

@mbabker having these prevents module chromes from rendering which might be desirable behavior in some cases. It's possible to address this in layout but that means ensuring no content (not even a whitespace) is outside of item check.

avatar mbabker
mbabker - comment - 20 Jun 2018

Oh I agree totally the check in and of itself is valid, but IMO it belongs to the layout to decide and not the main file because as is this forces the module to never render when there is an empty result set, and that might not always be the desired thing. Even that param seems acceptable for this use case (and I'm not a fan of having options for everything).

avatar brianteeman
brianteeman - comment - 20 Jun 2018

Iirc if you don't do it this way then joomla can end up with an empty column

avatar mbabker
mbabker - comment - 20 Jun 2018

I can't say I've ever run into the empty column scenario in the past, BUT, I'm pretty sure @SharkyKZ has exactly the conditions you can hit that with covered (essentially the check has to return before any output, as soon as something generates output then the module would be considered non-empty). It may also depend on the order of operations for module chrome (does that check for an empty output before applying chrome or is that the chrome's responsibility, because the system chrome handles that inconsistently whereas the Protostar chrome checks empty content).

avatar ggppdk
ggppdk - comment - 21 Jun 2018

It is a common request that empty content modules

  • do not effect the layout of the page (that includes not rendering module chromes),

and that is why people even use a popular 3rd party tool to even

  1. strip HTML on module content
  2. and then trim whitespace

and then consider that a module is empty ...

I agree with @mbabker that it belongs to the layout

But accepting this PR as it is, will change layout display of websites
if it was ever going to be the responsibility of the layout to return zero string it should have been done in the beginning.

You can move the IF statement inside the layout like it is for other modules

But now all existing custom layouts that have duplicated the default
https://github.com/joomla/joomla-cms/blob/staging/modules/mod_tags_similar/tmpl/default.php#L13

will start rendering module chromes on empty content

You are going to have bug reports after excepting this for this module

If you are going to accept this PR , at minimum the removed code should be added to the layout

avatar SharkyKZ
SharkyKZ - comment - 21 Jun 2018

@brianteeman @mbabker we end up with empty column anyways because HtmlDocument::countModules() counts empty modules. There's a PR pending for 4.0 to change this, see #19416.

@ggppdk Syncing with mod_tags_popular for 3.x is fully B/C, even with overrides. Return could be moved to layout in 4.0.

avatar brianteeman
brianteeman - comment - 21 Jun 2018

Iirc if you don't do it this way then joomla can end up with an empty column

I stand corrected - you do get the empty column before this PR

avatar SharkyKZ
SharkyKZ - comment - 21 Nov 2018

@david-bettondesign can you update this PR so that it matches mod_tags_popular (see #20811 (comment))?

avatar david-bettondesign
david-bettondesign - comment - 23 Nov 2018

Erm... I know I sound like an idiot but I don't know how! This was my first ever pull request.

avatar SharkyKZ
SharkyKZ - comment - 23 Nov 2018

Are you asking how to update the PR or what changes you need to make?

To update the PR you first need to restore the branch. There should be Restore Branch button somewhere on the page. If there isn't one, you'll need to create a new PR.

The changes needed are shown in #20811 (comment)

Essentially, you would need to add a new parameter to the XML file (and accompanying language strings in INI file) and update the check in the module file to check against the parameter.

avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Apr 2019
Title
Removed the return if no items found (Ref #20810)
Removed the return if no items found
avatar franz-wohlkoenig franz-wohlkoenig - edited - 19 Apr 2019
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 May 2019

@SharkyKZ can you update the PR? If not i suggest to close it due the lack of response by @david-bettondesign

avatar SharkyKZ
SharkyKZ - comment - 12 May 2019

@franz-wohlkoenig I don't think I can modify someone else's PR. I think only maintainers can.

I can make a new PR but I guess it will have to go into 4.0? Because new parameter added.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 May 2019

@SharkyKZ to be on safe Side i suggest to make a PR against J4-Branch.

clsong for the Reason stated above.

avatar franz-wohlkoenig franz-wohlkoenig - change - 12 May 2019
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2019-05-12 09:05:33
Closed_By franz-wohlkoenig
Labels Removed: J3 Issue
avatar franz-wohlkoenig franz-wohlkoenig - close - 12 May 2019

Add a Comment

Login with GitHub to post a comment