OgAdminRoutesEvent.php in Organic groups 8
File
src/Event/OgAdminRoutesEvent.php
View source
<?php
declare (strict_types=1);
namespace Drupal\og\Event;
use Drupal\og\OgAccess;
use Symfony\Component\EventDispatcher\Event;
class OgAdminRoutesEvent extends Event implements OgAdminRoutesEventInterface {
protected $routesInfo = [];
public function setRoutesInfo(array $routes_info) {
$this->routesInfo = $routes_info;
}
public function getRoutesInfo() {
return $this->routesInfo;
}
public function getRoutes($entity_type_id) {
$routes_info = [];
foreach ($this->routesInfo as $name => $route_info) {
$routes_info[$name] = $route_info;
$routes_info[$name] += [
'description' => '',
'requirements' => [
'_og_user_access_group' => OgAccess::ADMINISTER_GROUP_PERMISSION,
],
'options' => [
'parameters' => [
$entity_type_id => [
'type' => 'entity:' . $entity_type_id,
],
],
'_og_entity_type_id' => $entity_type_id,
'_admin_route' => TRUE,
],
'defaults' => [
'_controller' => $route_info['controller'],
'_title' => $route_info['title'],
],
];
}
return $routes_info;
}
}