Sigala's Blog

Complete working guide on how to enable previewing of hidden news records from the backend

Published

 1. Add Page TSconfig configuration

Add the configuration below to your Page TSconfig configuration.
The text after ### are comments and can be removed.

 

TCEMAIN {
    preview {
        tx_news_domain_model_news {
            previewPageId = <pageId> ## Replace <pageId> with the uid of a page containing the News Detail View plugin 
            useDefaultLanguageRecord = 0
            fieldToParameterMap {
               uid = tx_news_pi1[news_preview]
            }
            additionalGetParameters {
               tx_news_pi1.controller = News
               tx_news_pi1.action = detail
            }
       }
    }
}

 

For more information about this TSconfig configuration, check TSconfig Reference: TCEMAIN.preview.

2. Add TypoScript configuration

Add the configuration below to your site's TypoScript configuration

 

[traverse(page, "uid") == <previewPageID> && backend.user.isLoggedIn]
   plugin.tx_news.settings.enablePreviewOfHiddenRecords = 1
[END]

 

  • Replace <previewPageID> with the uid set as previewPageId above.
  • The TypoScript condition is just a security measure to prevent this page being called by anyone to display hidden records
  • For more on TypoScript conditions, check TypoScript Conditions.

If you faced any issues with the steps, just leave me a message via the contact form and I will get back to you.