chris
chris

Reputation: 2243

TYPO3: Deferent wrap for RECORDS ifEmpty

With the following Typoscript I get the value of my_title and if the field is empty the value of the field title:

lib.newsBreadcrumb = RECORDS
lib.newsBreadcrumb {
    dontCheckPid = 1
    tables = tx_news_domain_model_news
    source.data = GP:tx_news_pi1|news
    source.intval = 1
    conf.tx_news_domain_model_news = TEXT
    conf.tx_news_domain_model_news.field = my_title
    conf.tx_news_domain_model_news.stdWrap.ifEmpty.field = title
    conf.tx_news_domain_model_news.htmlSpecialChars = 1
    wrap = <li>|</li>
}

Now I would like to use a diferent wrap for the value of the field my_title.

Desired result:

<li><bold>my_title</bold></li>

versus

<li>title</li>

What I can do, is setting a different wrap for the ifEmpty part, but I don't get it to work for the "default" part.

Upvotes: 0

Views: 340

Answers (1)

Julian Hofmann
Julian Hofmann

Reputation: 2592

You can simplify the fallback (TSref: stdWrap.field):

conf.tx_news_domain_model_news.field = my_title // title

The wrap-property of TEXT has stdWrap-properties. So, you have the override-property (which has also stdWrap-properties):

conf.tx_news_domain_model_news.wrap = <li>|<li>
conf.tx_news_domain_model_news.wrap.override = <li><bold>|</bold><li>
conf.tx_news_domain_model_news.wrap.override.if.isTrue.field = my_title

Upvotes: 2

Related Questions