César Dueñas
César Dueñas

Reputation: 331

How set categorySelection a value of return of user funcion in Typoscript

I have a user function that return a list of categories (f.e. 20, 19) and I want to set in tt_news categorySelection as indicate the code

plugin.tt_news {
 categorySelection = user_ttNewsCategoriesByUID
 categoryMode = 2
}

Before of this I have the user function and works correctly

page.105 = USER
page.105 {
  includeLibs = EXT:tt_news/Categorias.php
  userFunc = user_ttNewsInCat
}

I am looking but I have not found something. How can I set the return of function in categorySelection

Upvotes: 0

Views: 77

Answers (2)

César Dueñas
César Dueñas

Reputation: 331

I found the answer and works correctly in this way

includeLibs.userCategories = EXT:tt_news/Categorias.php

temp.catuid = USER
temp.catuid.preUserFunc = user_ttNewsInCat

plugin.tt_news {    
  categorySelection < temp.catuid
  categoryMode = 2
}

Upvotes: 0

lorenz
lorenz

Reputation: 4558

Since categorySelection is stdWrap enabled (see reference), you should be able to make use of it like this:

plugin.tt_news {
 categorySelection >
 categorySelection.cObject = USER
 categorySelection.cObject.userFunc = user_ttNewsCategoriesByUID
 categoryMode = 2
}

Upvotes: 0

Related Questions