You are here

private function NodeEntityBundleController::getContentType in Permissions by Term 8.2

Same name and namespace in other branches
  1. 8 src/Controller/NodeEntityBundleController.php \Drupal\permissions_by_term\Controller\NodeEntityBundleController::getContentType()
1 call to NodeEntityBundleController::getContentType()
NodeEntityBundleController::getFormInfoByUrl in src/Controller/NodeEntityBundleController.php

File

src/Controller/NodeEntityBundleController.php, line 97

Class

NodeEntityBundleController
Class NodeEntityBundleController

Namespace

Drupal\permissions_by_term\Controller

Code

private function getContentType($nodeEditPath) {
  $alias = \Drupal::service('path.alias_manager')
    ->getPathByAlias($nodeEditPath);
  $params = Url::fromUri("internal:" . $alias)
    ->getRouteParameters();
  $entity_type = key($params);
  $node = \Drupal::entityTypeManager()
    ->getStorage($entity_type)
    ->load($params[$entity_type]);
  if ($node instanceof Node) {
    return $node
      ->getType();
  }
  return NULL;
}