Markus Dübbert
Markus Dübbert

Reputation: 213

ext news: How can make the category option mandatory?

Is there a way to make the categories mandatory for the editor?

If not, what is a useful workaround in the class? In this case I'm in a linkhandler class. If the category is empty, how can I echo an error message which does not end in complete whitescreen in frontend (or even better be).

Is there an example for such an error message call?

TYPO3 7.6.10
news 4.3.0

Upvotes: 1

Views: 219

Answers (1)

Georg Ringer
Georg Ringer

Reputation: 7939

In your sitepackage extension or any extension which is loaded after news, create the file Configuration/TCA/Overrides/tx_news_domain_model_news.php with the following content

<?php
defined('TYPO3_MODE') or die();

$GLOBALS['TCA']['tx_news_domain_model_news']['columns']['categories']['config']['minitems'] = 1;

If you want to show a message in the backend, a little bit more work would be required. In a hook of the DataHandler you could check the record after saving and add a flash message.

Upvotes: 4

Related Questions