{"action":"created","comment":{"url":"https://api.github.com/repos/openeuropa/openeuropa/pulls/comments/218366178","pull_request_review_id":156285012,"id":218366178,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxODM2NjE3OA==","diff_hunk":"@@ -0,0 +1,146 @@\n+# Routing system in Drupal 8\n+\n+When a user visits a particular URL on a Drupal site, the path they are visiting is a route. \n+Drupal's routing system helps figure out which [controller][1] is responsible for responding to the route (URI) being requested. \n+Drupal matches the incoming request's path to a controller by looking through the routes that have been registered in active modules.\n+\n+## Why a new routing system\n+\n+In prior versions of Drupal, there was only hook_menu. Hook menu actually managed a few different features.\n+In addition to handling incoming requests, it provided menu links, access control, action links, and a number of other features that are all very tightly coupled together.\n+By using the Symfony2 Routing component, we are able to split out the route handling aspect, and get a much improved and feature-rich solution.\n+Such as being able to create routes on more than just the path, for example make a request for JSON, XML or HTML while still using the same path. \n+\n+\n+## How the routing system works\n+\n+Drupal's routing system works with the Symfony HTTP Kernel. \n+The routing system is responsible for matching paths to controllers, and you define those relations in routes. You can pass on additional information to your controllers in the route. Access checking is integrated as well.\n+[See drupal.org][5]\n+\n+## Structure of routes and parameters\n+\n+The route structure inside the *module.routing.yml* file is described in [drupal.org][3]\n+\n+## Adding new routes (static & dynamic) and altering existing ones\n+\n+\n+### Adding a new static route\n+\n+1. In your example.routing.yml (let's use **example** module name as in drupal.org)\n+    \n+    Add your path, ( /something )\n+        and in *defaults:* \n+            add the controller class and the method who will do something.\n+            set a title\n+        as *requirements:*\n+            add permission   \n+        \n+\n+```\n+example.content:\n+  path: '/example' \n+  defaults: \n+    _controller: '\\Drupal\\example\\Controller\\ExampleController::content' \n+    _title: 'Hello World'\n+  requirements: \n+    _permission: 'access content' \n+```\n+    \n+\n+2. In your src/Controller add your page controller class and your methods\n+\n+\n+As basic route controller you can use Drupal\\Core\\Controller\\ControllerBase.\n+\n+```namespace Drupal\\example\\Controller;\n+\n+use Drupal\\Core\\Controller\\ControllerBase;\n+\n+/**\n+ * An example controller.\n+ */\n+class ExampleController extends ControllerBase {\n+\n+  /**\n+   * Returns a render-able array for a test page.\n+   */\n+  public function content() {\n+    $build = [\n+      '#markup' => $this->t('Hello World!'),\n+    ];\n+    return $build;\n+  }\n+}\n+```\n+\n+### Adding a new dynamic route\n+\n+You can use the alterRoutes() method to add dynamic routes as well. ","path":"docs/knowledge-base/routing-sytem.md","position":107,"original_position":79,"commit_id":"82742903d16f1853eefa02c42ff6a0dc2cbfc812","original_commit_id":"d510887836eaedfe133c93cae0d20265485f89d4","user":{"login":"Medi4tor","id":2235848,"node_id":"MDQ6VXNlcjIyMzU4NDg=","avatar_url":"https://avatars2.githubusercontent.com/u/2235848?v=4","gravatar_id":"","url":"https://api.github.com/users/Medi4tor","html_url":"https://github.com/Medi4tor","followers_url":"https://api.github.com/users/Medi4tor/followers","following_url":"https://api.github.com/users/Medi4tor/following{/other_user}","gists_url":"https://api.github.com/users/Medi4tor/gists{/gist_id}","starred_url":"https://api.github.com/users/Medi4tor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Medi4tor/subscriptions","organizations_url":"https://api.github.com/users/Medi4tor/orgs","repos_url":"https://api.github.com/users/Medi4tor/repos","events_url":"https://api.github.com/users/Medi4tor/events{/privacy}","received_events_url":"https://api.github.com/users/Medi4tor/received_events","type":"User","site_admin":false},"body":"Agreed, then we should  change everything and write a tutorial .","created_at":"2018-09-18T09:45:08Z","updated_at":"2018-09-18T09:45:08Z","html_url":"https://github.com/openeuropa/openeuropa/pull/23#discussion_r218366178","pull_request_url":"https://api.github.com/repos/openeuropa/openeuropa/pulls/23","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/openeuropa/openeuropa/pulls/comments/218366178"},"html":{"href":"https://github.com/openeuropa/openeuropa/pull/23#discussion_r218366178"},"pull_request":{"href":"https://api.github.com/repos/openeuropa/openeuropa/pulls/23"}},"in_reply_to_id":216923760},"pull_request":{"url":"https://api.github.com/repos/openeuropa/openeuropa/pulls/23","id":213541983,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEzNTQxOTgz","html_url":"https://github.com/openeuropa/openeuropa/pull/23","diff_url":"https://github.com/openeuropa/openeuropa/pull/23.diff","patch_url":"https://github.com/openeuropa/openeuropa/pull/23.patch","issue_url":"https://api.github.com/repos/openeuropa/openeuropa/issues/23","number":23,"state":"open","locked":false,"title":"OPENEUROPA-1121 : Add documentation for drupal 8 routing system.","user":{"login":"Medi4tor","id":2235848,"node_id":"MDQ6VXNlcjIyMzU4NDg=","avatar_url":"https://avatars2.githubusercontent.com/u/2235848?v=4","gravatar_id":"","url":"https://api.github.com/users/Medi4tor","html_url":"https://github.com/Medi4tor","followers_url":"https://api.github.com/users/Medi4tor/followers","following_url":"https://api.github.com/users/Medi4tor/following{/other_user}","gists_url":"https://api.github.com/users/Medi4tor/gists{/gist_id}","starred_url":"https://api.github.com/users/Medi4tor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Medi4tor/subscriptions","organizations_url":"https://api.github.com/users/Medi4tor/orgs","repos_url":"https://api.github.com/users/Medi4tor/repos","events_url":"https://api.github.com/users/Medi4tor/events{/privacy}","received_events_url":"https://api.github.com/users/Medi4tor/received_events","type":"User","site_admin":false},"body":"## OPENEUROPA-1121\r\n\r\n### Description\r\n\r\nAdd useful documentation about drupal 8 routing system\r\n\r\n### Change log\r\n\r\n- routing documentation and links\r\n\r\n","created_at":"2018-09-06T08:54:05Z","updated_at":"2018-09-18T09:45:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"380b4b51ac79f4646963e5d3a996fe2176ba4771","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/openeuropa/openeuropa/pulls/23/commits","review_comments_url":"https://api.github.com/repos/openeuropa/openeuropa/pulls/23/comments","review_comment_url":"https://api.github.com/repos/openeuropa/openeuropa/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openeuropa/openeuropa/issues/23/comments","statuses_url":"https://api.github.com/repos/openeuropa/openeuropa/statuses/82742903d16f1853eefa02c42ff6a0dc2cbfc812","head":{"label":"openeuropa:OPENEUROPA-1121","ref":"OPENEUROPA-1121","sha":"82742903d16f1853eefa02c42ff6a0dc2cbfc812","user":{"login":"openeuropa","id":35874187,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1ODc0MTg3","avatar_url":"https://avatars0.githubusercontent.com/u/35874187?v=4","gravatar_id":"","url":"https://api.github.com/users/openeuropa","html_url":"https://github.com/openeuropa","followers_url":"https://api.github.com/users/openeuropa/followers","following_url":"https://api.github.com/users/openeuropa/following{/other_user}","gists_url":"https://api.github.com/users/openeuropa/gists{/gist_id}","starred_url":"https://api.github.com/users/openeuropa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openeuropa/subscriptions","organizations_url":"https://api.github.com/users/openeuropa/orgs","repos_url":"https://api.github.com/users/openeuropa/repos","events_url":"https://api.github.com/users/openeuropa/events{/privacy}","received_events_url":"https://api.github.com/users/openeuropa/received_events","type":"Organization","site_admin":false},"repo":{"id":119870152,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk4NzAxNTI=","name":"openeuropa","full_name":"openeuropa/openeuropa","private":false,"owner":{"login":"openeuropa","id":35874187,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1ODc0MTg3","avatar_url":"https://avatars0.githubusercontent.com/u/35874187?v=4","gravatar_id":"","url":"https://api.github.com/users/openeuropa","html_url":"https://github.com/openeuropa","followers_url":"https://api.github.com/users/openeuropa/followers","following_url":"https://api.github.com/users/openeuropa/following{/other_user}","gists_url":"https://api.github.com/users/openeuropa/gists{/gist_id}","starred_url":"https://api.github.com/users/openeuropa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openeuropa/subscriptions","organizations_url":"https://api.github.com/users/openeuropa/orgs","repos_url":"https://api.github.com/users/openeuropa/repos","events_url":"https://api.github.com/users/openeuropa/events{/privacy}","received_events_url":"https://api.github.com/users/openeuropa/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/openeuropa/openeuropa","description":"A Directorate-General for Informatics (DIGIT) initiative fostering open source adoption in consolidating the European Institutions' web presence.","fork":false,"url":"https://api.github.com/repos/openeuropa/openeuropa","forks_url":"https://api.github.com/repos/openeuropa/openeuropa/forks","keys_url":"https://api.github.com/repos/openeuropa/openeuropa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openeuropa/openeuropa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openeuropa/openeuropa/teams","hooks_url":"https://api.github.com/repos/openeuropa/openeuropa/hooks","issue_events_url":"https://api.github.com/repos/openeuropa/openeuropa/issues/events{/number}","events_url":"https://api.github.com/repos/openeuropa/openeuropa/events","assignees_url":"https://api.github.com/repos/openeuropa/openeuropa/assignees{/user}","branches_url":"https://api.github.com/repos/openeuropa/openeuropa/branches{/branch}","tags_url":"https://api.github.com/repos/openeuropa/openeuropa/tags","blobs_url":"https://api.github.com/repos/openeuropa/openeuropa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openeuropa/openeuropa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openeuropa/openeuropa/git/refs{/sha}","trees_url":"https://api.github.com/repos/openeuropa/openeuropa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openeuropa/openeuropa/statuses/{sha}","languages_url":"https://api.github.com/repos/openeuropa/openeuropa/languages","stargazers_url":"https://api.github.com/repos/openeuropa/openeuropa/stargazers","contributors_url":"https://api.github.com/repos/openeuropa/openeuropa/contributors","subscribers_url":"https://api.github.com/repos/openeuropa/openeuropa/subscribers","subscription_url":"https://api.github.com/repos/openeuropa/openeuropa/subscription","commits_url":"https://api.github.com/repos/openeuropa/openeuropa/commits{/sha}","git_commits_url":"https://api.github.com/repos/openeuropa/openeuropa/git/commits{/sha}","comments_url":"https://api.github.com/repos/openeuropa/openeuropa/comments{/number}","issue_comment_url":"https://api.github.com/repos/openeuropa/openeuropa/issues/comments{/number}","contents_url":"https://api.github.com/repos/openeuropa/openeuropa/contents/{+path}","compare_url":"https://api.github.com/repos/openeuropa/openeuropa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openeuropa/openeuropa/merges","archive_url":"https://api.github.com/repos/openeuropa/openeuropa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openeuropa/openeuropa/downloads","issues_url":"https://api.github.com/repos/openeuropa/openeuropa/issues{/number}","pulls_url":"https://api.github.com/repos/openeuropa/openeuropa/pulls{/number}","milestones_url":"https://api.github.com/repos/openeuropa/openeuropa/milestones{/number}","notifications_url":"https://api.github.com/repos/openeuropa/openeuropa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openeuropa/openeuropa/labels{/name}","releases_url":"https://api.github.com/repos/openeuropa/openeuropa/releases{/id}","deployments_url":"https://api.github.com/repos/openeuropa/openeuropa/deployments","created_at":"2018-02-01T17:34:27Z","updated_at":"2018-09-12T09:46:37Z","pushed_at":"2018-09-18T09:39:53Z","git_url":"git://github.com/openeuropa/openeuropa.git","ssh_url":"git@github.com:openeuropa/openeuropa.git","clone_url":"https://github.com/openeuropa/openeuropa.git","svn_url":"https://github.com/openeuropa/openeuropa","homepage":"","size":88,"stargazers_count":23,"watchers_count":23,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":6,"watchers":23,"default_branch":"master"}},"base":{"label":"openeuropa:master","ref":"master","sha":"c61e38d37f1a979c3fc1df61c2e58a23aa655425","user":{"login":"openeuropa","id":35874187,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1ODc0MTg3","avatar_url":"https://avatars0.githubusercontent.com/u/35874187?v=4","gravatar_id":"","url":"https://api.github.com/users/openeuropa","html_url":"https://github.com/openeuropa","followers_url":"https://api.github.com/users/openeuropa/followers","following_url":"https://api.github.com/users/openeuropa/following{/other_user}","gists_url":"https://api.github.com/users/openeuropa/gists{/gist_id}","starred_url":"https://api.github.com/users/openeuropa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openeuropa/subscriptions","organizations_url":"https://api.github.com/users/openeuropa/orgs","repos_url":"https://api.github.com/users/openeuropa/repos","events_url":"https://api.github.com/users/openeuropa/events{/privacy}","received_events_url":"https://api.github.com/users/openeuropa/received_events","type":"Organization","site_admin":false},"repo":{"id":119870152,"node_id":"MDEwOlJlcG9zaXRvcnkxMTk4NzAxNTI=","name":"openeuropa","full_name":"openeuropa/openeuropa","private":false,"owner":{"login":"openeuropa","id":35874187,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM1ODc0MTg3","avatar_url":"https://avatars0.githubusercontent.com/u/35874187?v=4","gravatar_id":"","url":"https://api.github.com/users/openeuropa","html_url":"https://github.com/openeuropa","followers_url":"https://api.github.com/users/openeuropa/followers","following_url":"https://api.github.com/users/openeuropa/following{/other_user}","gists_url":"https://api.github.com/users/openeuropa/gists{/gist_id}","starred_url":"https://api.github.com/users/openeuropa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openeuropa/subscriptions","organizations_url":"https://api.github.com/users/openeuropa/orgs","repos_url":"https://api.github.com/users/openeuropa/repos","events_url":"https://api.github.com/users/openeuropa/events{/privacy}","received_events_url":"https://api.github.com/users/openeuropa/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/openeuropa/openeuropa","description":"A Directorate-General for Informatics (DIGIT) initiative fostering open source adoption in consolidating the European Institutions' web presence.","fork":false,"url":"https://api.github.com/repos/openeuropa/openeuropa","forks_url":"https://api.github.com/repos/openeuropa/openeuropa/forks","keys_url":"https://api.github.com/repos/openeuropa/openeuropa/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openeuropa/openeuropa/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openeuropa/openeuropa/teams","hooks_url":"https://api.github.com/repos/openeuropa/openeuropa/hooks","issue_events_url":"https://api.github.com/repos/openeuropa/openeuropa/issues/events{/number}","events_url":"https://api.github.com/repos/openeuropa/openeuropa/events","assignees_url":"https://api.github.com/repos/openeuropa/openeuropa/assignees{/user}","branches_url":"https://api.github.com/repos/openeuropa/openeuropa/branches{/branch}","tags_url":"https://api.github.com/repos/openeuropa/openeuropa/tags","blobs_url":"https://api.github.com/repos/openeuropa/openeuropa/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openeuropa/openeuropa/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openeuropa/openeuropa/git/refs{/sha}","trees_url":"https://api.github.com/repos/openeuropa/openeuropa/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openeuropa/openeuropa/statuses/{sha}","languages_url":"https://api.github.com/repos/openeuropa/openeuropa/languages","stargazers_url":"https://api.github.com/repos/openeuropa/openeuropa/stargazers","contributors_url":"https://api.github.com/repos/openeuropa/openeuropa/contributors","subscribers_url":"https://api.github.com/repos/openeuropa/openeuropa/subscribers","subscription_url":"https://api.github.com/repos/openeuropa/openeuropa/subscription","commits_url":"https://api.github.com/repos/openeuropa/openeuropa/commits{/sha}","git_commits_url":"https://api.github.com/repos/openeuropa/openeuropa/git/commits{/sha}","comments_url":"https://api.github.com/repos/openeuropa/openeuropa/comments{/number}","issue_comment_url":"https://api.github.com/repos/openeuropa/openeuropa/issues/comments{/number}","contents_url":"https://api.github.com/repos/openeuropa/openeuropa/contents/{+path}","compare_url":"https://api.github.com/repos/openeuropa/openeuropa/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openeuropa/openeuropa/merges","archive_url":"https://api.github.com/repos/openeuropa/openeuropa/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openeuropa/openeuropa/downloads","issues_url":"https://api.github.com/repos/openeuropa/openeuropa/issues{/number}","pulls_url":"https://api.github.com/repos/openeuropa/openeuropa/pulls{/number}","milestones_url":"https://api.github.com/repos/openeuropa/openeuropa/milestones{/number}","notifications_url":"https://api.github.com/repos/openeuropa/openeuropa/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openeuropa/openeuropa/labels{/name}","releases_url":"https://api.github.com/repos/openeuropa/openeuropa/releases{/id}","deployments_url":"https://api.github.com/repos/openeuropa/openeuropa/deployments","created_at":"2018-02-01T17:34:27Z","updated_at":"2018-09-12T09:46:37Z","pushed_at":"2018-09-18T09:39:53Z","git_url":"git://github.com/openeuropa/openeuropa.git","ssh_url":"git@github.com:openeuropa/openeuropa.git","clone_url":"https://github.com/openeuropa/openeuropa.git","svn_url":"https://github.com/openeuropa/openeuropa","homepage":"","size":88,"stargazers_count":23,"watchers_count":23,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":6,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openeuropa/openeuropa/pulls/23"},"html":{"href":"https://github.com/openeuropa/openeuropa/pull/23"},"issue":{"href":"https://api.github.com/repos/openeuropa/openeuropa/issues/23"},"comments":{"href":"https://api.github.com/repos/openeuropa/openeuropa/issues/23/comments"},"review_comments":{"href":"https://api.github.com/repos/openeuropa/openeuropa/pulls/23/comments"},"review_comment":{"href":"https://api.github.com/repos/openeuropa/openeuropa/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openeuropa/openeuropa/pulls/23/commits"},"statuses":{"href":"https://api.github.com/repos/openeuropa/openeuropa/statuses/82742903d16f1853eefa02c42ff6a0dc2cbfc812"}},"author_association":"NONE"}}
{"actor":{"display_login":"Medi4tor"}}