You are here

test_decoupled_router.module in Decoupled Router 2.x

Allows to extend the functionalities of the decouple router.

File

tests/modules/test_decoupled_router/test_decoupled_router.module
View source
<?php

/**
 * @file
 * Allows to extend the functionalities of the decouple router.
 */
use Drupal\user\EntityOwnerInterface;

/**
 * Implements hook_decoupled_router_info_alter().
 */
function test_decoupled_router_decoupled_router_info_alter(&$output, $context) {
  $entity = $context['entity'];
  if (!is_subclass_of($entity, EntityOwnerInterface::class)) {
    return;
  }
  $output['entity']['owner'] = $entity
    ->getOwner()
    ->uuid();
}