Last active
August 14, 2016 22:06
-
-
Save pedrorocha-net/4ebbb7a6d8cf30e6c031 to your computer and use it in GitHub Desktop.
Example of page route in Drupal, with the Cool module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\my_page\PageControllers; | |
class MyPage implements \Drupal\cool\Controllers\PageController { | |
public static function accessCallback() { | |
return TRUE; | |
} | |
public static function getDefinition() { | |
return array( | |
'title' => t('My page') | |
); | |
} | |
public static function getPath() { | |
return 'my-page-url'; | |
} | |
public static function pageCallback() { | |
return '<h1>' . t('This is my new page!') . '</h1>'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment