Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace DrupalmymoduleController;
- use DrupalCoreControllerControllerBase;
- class ExampleController extends ControllerBase {
- /**
- * Controller for action button.
- */
- public function action() {
- // if user is not logged in, redirect to create a new account
- if ($this->currentUser()->isAnonymous()) {
- return $this->redirect('user.register');
- }
- // return content or redirect to content
- return ...;
- }
- }
Add Comment
Please, Sign In to add comment