RouteSubscriber.php in Edit own user account permission 8
File
src/Routing/RouteSubscriber.php
View source
<?php
namespace Drupal\edit_own_user_account_permission\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;
class RouteSubscriber extends RouteSubscriberBase {
public function alterRoutes(RouteCollection $collection) {
if ($route = $collection
->get('entity.user.edit_form')) {
$route
->setRequirement('_custom_access', '\\Drupal\\edit_own_user_account_permission\\Access\\EditOwnUserAccountAccessCheck::access');
}
}
}