Commit 21fc02cf authored by webchick's avatar webchick

Issue #2290129 by jhodgdon, Gábor Hojtsy, Crell, joachim: Menu/routing topic needs an overhaul.

parent 83229e05
This diff is collapsed.
......@@ -30,6 +30,8 @@
* service.
*
* @see \Drupal\Core\DependencyInjection\ContainerInjectionInterface
*
* @ingroup menu
*/
abstract class ControllerBase implements ContainerInjectionInterface {
use StringTranslationTrait;
......
......@@ -19,6 +19,8 @@
* ControllerBase as that allows direct access to the container. That renders
* the controller very difficult to unit test so should only be used for
* controllers that are trivial in complexity.
*
* @ingroup menu
*/
interface ContainerInjectionInterface {
......
......@@ -14,6 +14,8 @@
* HTML that would not be part of the HTML string itself. That includes, for
* example, required CSS files, Javascript files, link tags, meta tags, and the
* title of a page or page section.
*
* @ingroup menu
*/
interface HtmlFragmentInterface {
......
......@@ -313,13 +313,13 @@
* entity interface you have defined as its parameter, and returns routing
* information for the entity page; see node_uri() for an example. You will
* also need to add a corresponding route to your module's routing.yml file;
* see the node.view route in node.routing.yml for an example, and see the
* @link menu Menu and routing @endlink topic for more information about
* routing.
* see the node.view route in node.routing.yml for an example, and see
* @ref sec_routes below for some notes.
* - Define routing and links for the various URLs associated with the entity.
* These go into the 'links' annotation, with the link type as the key, and
* the route machine name (defined in your module's routing.yml file) as the
* value. Typical link types are:
* value; see @ref sec_routes below for some routing notes. Typical link
* types are:
* - canonical: Default link, either to view (if entities are viewed on their
* own pages) or edit the entity.
* - delete-form: Confirmation form to delete the entity.
......@@ -339,6 +339,37 @@
* (configuration). These annotations are documented on
* \Drupal\Core\Entity\EntityType.
*
* @section sec_routes Entity routes
* Entity routes, like other routes, are defined in *.routing.yml files; see
* the @link menu Menu and routing @endlink topic for more information. Here
* is a typical entry, for the block configure form:
* @code
* block.admin_edit:
* path: '/admin/structure/block/manage/{block}'
* defaults:
* _entity_form: 'block.default'
* _title: 'Configure block'
* requirements:
* _entity_access: 'block.update'
* @endcode
* Some notes:
* - path: The {block} in the path is a placeholder, which (for an entity) must
* always take the form of {machine_name_of_entity_type}. In the URL, the
* placeholder value will be the ID of an entity item. When the route is used,
* the entity system will load the corresponding entity item and pass it in as
* an object to the controller for the route.
* - defaults: For entity form routes, use _entity_form rather than the generic
* _content or _form. The value is composed of the entity type machine name
* and a form controller type from the entity annotation (see @ref define
* above more more on controllers and annotation). So, in this example,
* block.default refers to the 'default' form controller on the block entity
* type, whose annotation contains:
* @code
* controllers = {
* "form" = {
* "default" = "Drupal\block\BlockForm",
* @endcode
*
* @section load_query Loading and querying entities
* To load entities, use the entity storage manager, which is an object
* implementing \Drupal\Core\Entity\EntityStorageInterface that you can
......
......@@ -437,6 +437,8 @@ function hook_page_build(&$page) {
* in the UI.
* - options: (optional) An array of options to be passed to l() when
* generating a link from this menu item.
*
* @ingroup menu
*/
function hook_menu_link_defaults_alter(&$links) {
// Change the weight and title of the user.logout link.
......@@ -511,6 +513,8 @@ function hook_menu_local_tasks(&$data, $route_name) {
* The route name of the page.
*
* @see hook_menu_local_tasks()
*
* @ingroup menu
*/
function hook_menu_local_tasks_alter(&$data, $route_name) {
}
......@@ -523,6 +527,8 @@ function hook_menu_local_tasks_alter(&$data, $route_name) {
*
* @see \Drupal\Core\Menu\LocalActionInterface
* @see \Drupal\Core\Menu\LocalActionManager
*
* @ingroup menu
*/
function hook_menu_local_actions_alter(&$local_actions) {
}
......@@ -572,6 +578,8 @@ function hook_local_tasks_alter(&$local_tasks) {
* @endcode
*
* @see \Drupal\Core\Menu\ContextualLinkManager
*
* @ingroup menu
*/
function hook_contextual_links_alter(array &$links, $group, array $route_parameters) {
if ($group == 'menu') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment