Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.com_content.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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.<br />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,<br />make sure you define the Options in the desired layout."
Expand Down
36 changes: 36 additions & 0 deletions plugins/content/joomla/joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}