douzai9405 2016-05-22 05:12
浏览 50
已采纳

Silverstripe - 如何向现有控制器添加新操作

AccountPage_Controller under core_shop module has defined some actions under /account url.

I want to add a new action under /account, how can i do it?

  • 写回答

1条回答 默认 最新

  • doufu3718 2016-05-22 21:36
    关注

    You haven't said which version of SilverStripe framework or cms you're using. Assuming v3 or above and depending on your scenario, using custom Extension subclasses known as "Decorators" is prob the best way to go.

    • Decorate AccountPage_Controller by creating your own custom controller with the desired custom action and $allowed_actions static
    • Reference your custom controller in an extensions block in your config.yml
    • run dev/build flush=all
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 武汉岩海低应变分析软件,导数据库里不显示波形图
  • ¥15 CreateBitmapFromWicBitmap内存释放问题。
  • ¥30 win c++ socket
  • ¥15 CanMv K210开发板实现功能
  • ¥15 C# datagridview 栏位进度
  • ¥15 vue3页面el-table页面数据过多
  • ¥100 vue3中融入gRPC-web
  • ¥15 kali环境运行volatility分析android内存文件,缺profile
  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题