I set up a text format for conditional text, and a node with the following in the body:

[condition installed views > 7.x-3.0]
This part should only display if views is installed.
[/condition]
[condition installed block >= 7.0]
This part should display if Block is enabled and 7.x
[/condition]

None of the conditional text is displaying at all when I have the filter settings on "filter display plugin". I think it should show the Block sections and hide the Views section.

When I change to "fieldset", it is displaying the Block section by default and the Views section is hidden by default, so that is correct.

Comments

jhodgdon’s picture

Also, I think if we are in Fieldset mode, we should just make all the conditional text fieldsets closed by default, rather than basing the decision on what is currently installed on the site where the text is being displayed.

The reason is that the purpose of Fieldset mode is for sites like the proposed help.drupal.org, where what modules are installed on that particular site has no relevance at all to what the site visitor wants to read about. So I think the best thing is just to hide all of the conditional text in fieldsets by default, and the user can open the sections that are relevant to them.

tamasd’s picture

Assigned: Unassigned » tamasd
Category: bug » support

The filter display plugin filters out the text completely. It was one of the requested display types.

tamasd’s picture

The module can be configured this way. However, to make this easier, it might be a wise thing to add a boolean condition plugin (so you can say true or false). With that, you can write a condition like:
[condition installed views >= 7.x-3.0 and false]
And it will hide the text always.

Or, you can configure the installed plugin that way that every module, what you have installed has version 0, and since other modules are not installed, the condition will be evaluated to FALSE.

Or, I can do some syntax magic for the installed module to enable negation. So in the filter setting, instead of saying that you have module with a given version, you can say that you don't have that module installed.

jhodgdon’s picture

I don't understand this idea. Why would someone want to hide *all* conditional text? Then it is not conditional.

The specifications page says:

a) "Show/hide completely before sending to the browser -- for instance, on a site that has Views 2.x, completely omit the Views 3.x conditional text. Or if the user is role A, completely omit some of the conditional text for things they don't have permission to do."
So the idea here was "Show if the condition is true, and hide if the condition is false". Not "Hide all conditional text completely".

b) "Use a fieldset -- for instance, on help.drupal.org, have the Views 2.x and Views 3.x text available in collapsed/open fieldsets." [I think you have this one working, basically]

c) "Use CSS classes -- for instance, put the Views 2.x and Views 3.x text into DIVs with appropriate CSS classes, and then use JQuery/JavaScript to have tabs/buttons/select lists that would display or hide the different versions of the page, hiding/showing the appropriate conditional text." [lower priority por now]

jhodgdon’s picture

Category: support » bug
tamasd’s picture

This works exactly as you described in a).

However I am not sure if you omit the core version the version comparing works properly.

jhodgdon’s picture

Well, I would expect the text in
[condition installed block >= 7.0]
[/condition]
to be displayed, because the version of Block on my site is 7.2. Right?

tamasd’s picture

Title: Installed conditional text not working in "filter display plugin" mode? » Module versions without the core version does not work properly
Status: Active » Needs review

Proposed fix: 202c350bf88c15a1848002dbc28c6ac5c0d831a6.

jhodgdon’s picture

Status: Needs review » Needs work

This is still not working for me, after updating to the latest master.

jhodgdon’s picture

Status: Needs work » Fixed

This is now working correctly.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.