anru
anru

Reputation: 1414

Silverstripe - How to add a new action to the existing controller

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?

Upvotes: 1

Views: 148

Answers (1)

theruss
theruss

Reputation: 1746

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

Upvotes: 4

Related Questions