diff --git a/administrator/language/en-GB/en-GB.com_content.ini b/administrator/language/en-GB/en-GB.com_content.ini index 7370f5b0e8480..3c2ff72340d45 100644 --- a/administrator/language/en-GB/en-GB.com_content.ini +++ b/administrator/language/en-GB/en-GB.com_content.ini @@ -34,6 +34,7 @@ COM_CONTENT_CREATE_ARTICLE_CATEGORY_LABEL="Default Category" COM_CONTENT_CREATE_ARTICLE_CATEGORY_DESC="If set to 'Yes', this page will only let you create articles in the category selected below." COM_CONTENT_CREATE_ARTICLE_CUSTOM_CANCEL_REDIRECT_DESC="If set to 'Yes', you can set a redirection page, distinct from above 'Submission/Cancel Redirect', to redirect to when user Cancels article submission.
If set to 'No', when user Cancels article submission, the user is redirected to the above 'Submission/Cancel Redirect' page." COM_CONTENT_CREATE_ARTICLE_CUSTOM_CANCEL_REDIRECT_LABEL="Custom Redirect on Cancel" +COM_CONTENT_CREATE_ARTICLE_ERROR="When default category is enabled, a category should be selected." COM_CONTENT_CREATE_ARTICLE_REDIRECTMENU_DESC="Select the page the user will be redirected to after a successful article submission and after cancel (if not set differently below). The default is to redirect to the home page." COM_CONTENT_CREATE_ARTICLE_REDIRECTMENU_LABEL="Submission/Cancel Redirect" COM_CONTENT_DRILL_CATEGORIES_LABEL="List or Blog: after choosing the display,
make sure you define the Options in the desired layout." diff --git a/plugins/content/joomla/joomla.php b/plugins/content/joomla/joomla.php index 39978543e3909..938d10b53ee86 100644 --- a/plugins/content/joomla/joomla.php +++ b/plugins/content/joomla/joomla.php @@ -299,4 +299,40 @@ public function onContentChangeState($context, $pks, $value) return true; } + + /** + * The save event. + * + * @param string $context The context + * @param object $table The item + * @param boolean $isNew Is new item + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function onContentBeforeSave($context, $table, $isNew) + { + // Check we are handling the frontend edit form. + if ($context !== 'com_menus.item') + { + return true; + } + + // Special case for Create article menu item + if ($table->link !== 'index.php?option=com_content&view=form&layout=edit') + { + return true; + } + + // Display error if catid is not set when enable_category is enabled + $params = json_decode($table->params, true); + + if ($params['enable_category'] == 1 && empty($params['catid'])) + { + $table->setError(JText::_('COM_CONTENT_CREATE_ARTICLE_ERROR')); + + return false; + } + } }