Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

globalVar / routeEnhancers #848

Closed
prdt3e opened this issue Feb 8, 2019 · 17 comments
Closed

globalVar / routeEnhancers #848

prdt3e opened this issue Feb 8, 2019 · 17 comments

Comments

@prdt3e
Copy link

prdt3e commented Feb 8, 2019

When I use routeEnhancers, I no longer have access to:
[globalVar = GP: tx_news_pi1|news > 0]
and must use:
[request.getQueryParams () ['tx_news_pi1'] ['news']> 0]

If I use Insertdata to generate a variable(TS) with GP: tx_news_pi1|news, it will not be null.

Thanks

@georgringer
Copy link
Owner

And what should I change?

@prdt3e
Copy link
Author

prdt3e commented Feb 8, 2019

If I knew that, I would suggest it to you :)
Possibly is also a core problem?
Or handover routeEnhancers to News.

@georgringer
Copy link
Owner

nothing I can do within EXT:news, I am closing the issue

@hhchrizzo
Copy link

hhchrizzo commented Aug 20, 2019

See https://forge.typo3.org/issues/88252

But i looks like things like
if.isTrue.data = GP:tx_news_pi1|news
Wont work anymore while using routeEnhancers.

Condtions for other Extensions still working.

TYPO3 9.5.9
News 7.2.3

@fnagel
Copy link
Contributor

fnagel commented Oct 17, 2019

Trying to get this to work again:

[globalVar = GP:tx_news_pi1|news > 0] OR [globalVar = GP:tx_news_pi1|news_preview > 0]

Tried something like this without any success.

[request.getPageArguments().get('tx_news_pi1').get('news') > 0] OR [request.getPageArguments().get('tx_news_pi1').get('news_preview') > 0]

[request.getPageArguments().get('tx_news_pi1|news') > 0] OR [request.getPageArguments().get('tx_news_pi1|news_preview') > 0]

[request.getPageArguments().get('tx_news_pi1.news') > 0] OR [request.getPageArguments().get('tx_news_pi1.news_preview') > 0]

[request.getPageArguments().get('tx_news_pi1[news]') > 0] OR [request.getPageArguments().get('tx_news_pi1[news_preview]') > 0]

[request.getPageArguments().get("tx_news_pi1['news']") > 0] OR [request.getPageArguments().get("tx_news_pi1['news_preview']") > 0]

Somebody able to help?

@mtness
Copy link
Contributor

mtness commented Oct 17, 2019

since this issue was closed already, stackoverflow might be a better place to get an answer?

@fnagel
Copy link
Contributor

fnagel commented Oct 17, 2019

Google brings me here, so no.

For anybody interested, take a look here:
https://typo3.slack.com/archives/C025BQLFA/p1571309329468900 and
https://forge.typo3.org/issues/88756

Spoiler: it's not possible out of the box.

@prdt3e
Copy link
Author

prdt3e commented Oct 17, 2019

[request.getQueryParams()['tx_news_pi1']['preview'] > 0] OR [request.getQueryParams()['tx_news_pi1']['news'] > 0]

does it work?

@prdt3e
Copy link
Author

prdt3e commented Oct 17, 2019

i have tested it and should actually work

@liayn
Copy link
Contributor

liayn commented Jan 12, 2020

see also https://forge.typo3.org/issues/89176

@liayn
Copy link
Contributor

liayn commented Apr 13, 2020

@georgringer @xerc See #1216

@w010
Copy link

w010 commented Aug 31, 2020

Sorry for posting in closed thread. I was looking for a solution and came here. I didn't find it in this thread, but I figured it out so I'm posting a solution. Maybe somebody still needs this or will land here like me.

This is the right syntax how to get array values using getPageArguments:
[request.getPageArguments().get('tx_news_pi1')['news'] > 0]
It works for me, at least in 10.4.

@liayn
Copy link
Contributor

liayn commented Sep 1, 2020

@w010 Or use [traverse(request.getQueryParams(), 'tx_news_pi1/news') > 0]

@xerc
Copy link
Contributor

xerc commented Sep 2, 2020

or shorter [request.getQueryParams()['tx_news_pi1']['news']]

@w010
Copy link

w010 commented Sep 2, 2020

Yes but then I needed it using explicitly getPageArguments for some reasons.

[request.getPageArguments().get('tx_news_pi1')['news'] > 0]
It works for me, at least in 10.4.

[Update, just for archiving] Actually, It turned that it does not, It spams error log when that argument is not specified.
But now nevermind, I used the [traverse(re.... - way, and it seems to work ok in all my cases, and to be the most sure way from all I tested. Only it's name/form is kinda misleading (looks more like some special-use thing, not the most default get/post eval). As of, what I believe it is, direct succesor/migration from good ol' globalVar=GP, which just works, it looks let's say maybe weird for some.

@liayn
Copy link
Contributor

liayn commented Sep 3, 2020

It spams error log when that argument is not specified.

Exactly. This is the reason I introduced the traverse operation. It allows to traverse any array (this includes of course GET/POST).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants