2
我一直在試圖做一個擴展來爲CMS添加一些功能。由於它是CMS的設置,我已將它添加到設置選項卡。雖然我可以採取值並保存它們,但我需要在頁面上執行一個操作來同步系統,但無法調用我的操作,這裏是我的代碼。將表單動作添加到配置頁面
private static $db = array(
'Path' => 'Varchar(50)',
);
private static $allowed_actions = array (
'update',
);
public function updateCMSFields(FieldList $fields)
{
$fields->addFieldsToTab('Root.Importer', array(
ImporterPathField::create('Path', 'Path')->setDescription('Path to area'),
FormAction::create('update', 'Synchronise')
));
}
public function update() {
SS_Log::add_writer(new SS_LogEmailWriter('[email protected]'), SS_Log::ERR);
}
它沒有被調用。如果我需要將功能添加到左側導航欄而不是部分設置,我也可以,但我也嘗試過,甚至不太成功。是否有可能獲得按鈕按下的動作?