Silverstripe附加更多选项动作

时间:2014-10-07 15:22:44

标签: silverstripe

想知道在向Silverstripe 3.1中的更多选项菜单编辑页面时是否可以添加其他操作

使用下面的示例,我添加了一个额外的FormAction,我在编辑页面时可以看到它。但是我在哪里实际添加“custom_action”方法?

class CustomPage extends SiteTree {
  function getCMSActions(){
    $actions = parent::getCMSActions();

    $actions->addFieldToTab(
      'ActionMenus.MoreOptions', 
      new FormAction('custom_action', 'Custom Action')
    );

    return $actions;
  }
}

class CustomPage_Controller extends ContentController {
  public function init() {
    parent::init();

    if(!Member::currentUserID()) {
      die();
    }
  }
}

0 个答案:

没有答案