我知道這裏有很多問題,但是我已經通過解決方案找到了所有找到的問題,但都無法解決我的問題。onContentBeforeSave和onContentAfterSave沒有觸發
保存來自前端和後端的文章時,onContentBeforeSave和onContentAfterSave事件都不會觸發。 同一插件中的onContentBeforeDisplay事件正常工作。
這是我的代碼,你有什麼想法嗎?謝謝。
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.plugin.plugin');
class plgContentBillrepeat extends JPlugin {
/**
* Load the language file on instantiation. Note this is only available in Joomla 3.1 and higher.
* If you want to support 3.0 series you must override the constructor
*
* @var boolean
* @since 3.1
*/
protected $autoloadLanguage = true;
/**
* Plugin method with the same name as the event will be called automatically.
*/
function onContentBeforeSave($context, &$article, $isNew) {
JError::raiseNotice(100, 'onContentBeforeSave plugin fired!');
return true;
}
function onContentAfterSave($context, &$article, $isNew) {
JError::raiseNotice(100, 'onContentAfterSave plugin fired!');
}
function onContentBeforeDisplay($context, &$article, &$params, $limit=0) {
JError::raiseNotice(100, 'onContentBeforeDisplay plugin fired!');
return "";
}
}
?>
我假設這是一個內容插件,你會不會添加你用於未來參考的Joomla版本? –