Guest User

Untitled

a guest
Jan 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. namespace DrupalmymoduleController;
  2.  
  3. use DrupalCoreControllerControllerBase;
  4.  
  5. class ExampleController extends ControllerBase {
  6.  
  7. /**
  8. * Controller for action button.
  9. */
  10. public function action() {
  11. // if user is not logged in, redirect to create a new account
  12. if ($this->currentUser()->isAnonymous()) {
  13. return $this->redirect('user.register');
  14. }
  15. // return content or redirect to content
  16. return ...;
  17. }
  18.  
  19. }
Add Comment
Please, Sign In to add comment