Feature #18211
Array of display conditions for TCA fields instead of 1 string
Status: | Resolved | Start date: | 2008-02-14 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | - | % Done: | 100% |
|
Category: | FormEngine aka TCEforms | Spent time: | - | |
Target version: | 6.1.0-beta1 | |||
PHP Version: | 5.3 | Sprint Focus: | ||
Complexity: | medium |
Description
I think that the option "displayCond" should be an array of conditions instead of just one string.
'displayCond' => Array (
"FIELD:myfieldname:!=:myvalue",
"FIELD:myfieldname:IN:4,5,6",
),
(issue imported from #M7531)
Related issues
Associated revisions
[FEATURE] Support multiple display conditions in TCA
The displayCond option is expanded with support for multiple
conditions and even the logical operators OR and AND.
Change-Id: I6cb38ef83093ed7399b47701e234ac13bdfa47dd
Fixes: #18211
Releases: 6.1
Reviewed-on: https://review.typo3.org/13508
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
History
#1 Updated by Ralf Hettinger about 6 years ago
I'm in the need for a similar thing, though it is a bit more complex here. So I decided to come up with the attached patch, which allows grouping by AND or OR and works recursively... the following example reads
displayCond true if
(my_field1 &&
my_field2!=3 &&
(my_field3 || my_field4 || my_field5 && my_field6) ||
my_field7 ||
my_field8
)
[...]
'displayCond' => array (
'AND' => array (
'FIELD:my_field1:REQ:true',
'FIELD:my_field2:!=:3',
'OR' => array (
'FIELD:my_field3:REQ:true',
'FIELD:my_field4:REQ:true',
'AND' => array(
'FIELD:my_field5:REQ:true',
'FIELD:my_field6:REQ:true',
)
)
),
'OR' => array (
'FIELD:my_field7:REQ:true',
'FIELD:my_field8:REQ:true',
)
),
[...]
#2 Updated by Ralf Hettinger about 6 years ago
forgot to mention: patched against 4.3 trunk rev. 5639
#3 Updated by Steffen Müller about 4 years ago
any news here. is this still an issue? would be nice to have this feature
#4 Updated by Xavier Perseguers about 4 years ago
- Target version changed from 4.6.0 to 4.6.0-beta1
#5 Updated by Xavier Perseguers about 4 years ago
- Target version deleted (
4.6.0-beta1)
#6 Updated by Stefano Cecere over 3 years ago
@Xavier: why did you drop this feature? i just checked it and seems ok (and useful)
should we propose it to 4.7?
#7 Updated by Gabriel Kaufmann / Typoworx NewMedia over 3 years ago
Stefano Cecere wrote:
@Xavier: why did you drop this feature? i just checked it and seems ok (and useful)
should we propose it to 4.7?
I also agree that this feature could be very useful! Why isn't this feature going into the core?
#8 Updated by Michael Sollmann over 3 years ago
4.8?
#9 Updated by Robert Wildling about 3 years ago
I'd like to join the credo! Please get it into core! Thanks!
#10 Updated by Stefan Neufeind about 3 years ago
Haven't taken a look at the actual implementation. But yes, it would be really great to be able to combine multiple conditions.
Since 4.8 will be called 6.0 now, maybe for 6.0? :-)
#11 Updated by Jigal van Hemert about 3 years ago
- Category set to FormEngine aka TCEforms
- Status changed from New to Accepted
- Target version set to 6.0.0-alpha3
- Complexity set to medium
Seems like a useful feature. Anyone who wants to push a patch to gerrit?
#12 Updated by Helmut Hummel about 3 years ago
- Status changed from Accepted to Needs Feedback
How about introducing a USERFUNC: option?
Would that serve your needs. The proposed array solution looks complex and there will be edge cases which still cannot be covered
#13 Updated by Stefan Neufeind about 3 years ago
USERFUNC for complex scenarios might be good to have. But imho we should have something built in as was proposed with that patch (though it looks complex at first). But I think for some small AND/OR it's more handy to have that builtin than through a USERFUNC whenever you need it.
Also note that USERFUNC might work on the server-side - but we have it on the client (JS) as well (flexform with displayCond).
#14 Updated by Gerrit Code Review almost 3 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/13508
#15 Updated by Ralf Hettinger almost 3 years ago
As author of this patch some years ago I'm hereby adding my vote for it ... :)
I haven't needed this neat feature for quite a while - as until today. The feature is tested in a productive environment since 3 years without any failures; the patch is still applying to 4.7.
For those who need a quick&dirty solution (like me today), I uploaded an extension which XClasses t3lib_tceforms (please forgive me, dear TYPO3 gods ;) )
#16 Updated by Gabriel Kaufmann / Typoworx NewMedia almost 3 years ago
You've also got my positive vote ;-)
Ralf Hettinger wrote:
As author of this patch some years ago I'm hereby adding my vote for it ... :)
For those who need a quick&dirty solution (like me today), I uploaded an extension which XClasses t3lib_tceforms (please forgive me, dear TYPO3 gods ;) )
May be there is any processing-hook that may be suiteable for adding the patch?
I think this patch is a must-have to go into the TYPO3-Core.
#17 Updated by Helmut Hummel over 2 years ago
- Target version changed from 6.0.0-alpha3 to 6.0.1
#18 Updated by Gerrit Code Review over 2 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/13508
#19 Updated by Gerrit Code Review over 2 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/13508
#20 Updated by Gerrit Code Review over 2 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/13508
#21 Updated by Gabriel Kaufmann / Typoworx NewMedia over 2 years ago
Is there any plan to finally integrate multiple displayCond into the "final" TYPO3-Core anytime?
More complex TYPO3-Plugin make it really neccessary to integrate such a feature! And for now the only "Hack" ist to locally patch or XClass TYPO3 to get it working. Neither the one nore the other of these is really good to handle.
Please let us know when this feature will be going to be finally reviewed and integrated into TYPO3-Core.
#22 Updated by Ingo Renner over 2 years ago
Gabriel, if you want this feature so much, why is there no review from you?
#23 Updated by Gabriel Kaufmann / Typoworx NewMedia over 2 years ago
Ingo Renner wrote:
Gabriel, if you want this feature so much, why is there no review from you?
Well what can I say much more. I think there have been enough suggestions how to implement this feature. I would prefer the Array-Way combined with the possibility for a userFunc for more complex matches. The userFunc-Method would also keep the door's open for further matching-patterns that may be implemented into core later on.
#24 Updated by Gerrit Code Review over 2 years ago
Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/13508
#25 Updated by Gerrit Code Review over 2 years ago
Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/13508
#26 Updated by Christian Kuhn over 2 years ago
- Target version changed from 6.0.1 to 6.1.0-beta1
- PHP Version changed from 5.0 to 5.3
#27 Updated by Jigal van Hemert over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset fe3e0a805e45478130fc75542a6db1da4b3e1aa4.
#28 Updated by Steffen Müller over 2 years ago
Thanks a lot for merging this.
Does this also work in flexforms? If so, could you please give us an example?
#29 Updated by Stefan Froemken over 2 years ago
Steffen Müller wrote:
Thanks a lot for merging this.
Does this also work in flexforms? If so, could you please give us an example?
Yes it also works in FlexForms. I just have created a documentation in german. At the bottom you see a nested example how to use this cool new feature in FlexForms.
Link: http://jweiland.net/typo3/extension-programmierung/displaycond.html
Stefan