public function getEntityPath($type, $id)
    {
        // Allow other modules to interact
        $event = new EntityGetPathEvent($type, $id);
        $this->eventDispatcher->dispatch(EntityGetPathEvent::EVENT_GET_PATH, $event);
        if ($path = $event->getPath()) {
            return $path;
        }

        // In most cases, this will be used for nodes only, so just set the
        // node URL.
        // It will avoid nasty bugs, since the 'text' core module does sanitize
        // (and call check_markup()) during field load if there are any circular
        // links dependencies between two nodes, it triggers an finite loop.
        // This will also make the whole faster.
        // @todo If node does not exists, no error will be triggered.
        if ('node' === $type) {
            return 'node/' . $id;
        }

        $entity = $this->entityManager->getStorage($type)->load($id);
        if (!$entity) {
            throw new \InvalidArgumentException(sprintf("entity of type %s with identifier %s does not exist", $type, $id));
        }

        if (!$entity instanceof EntityInterface) {
            return $this->getDrupalEntityPath($type, $entity);
        } else {
            return $entity->url();
        }
    }
public function getEntityPath($type, $id)
    {
        // Allow other modules to interact
        $event = new EntityGetPathEvent($type, $id);
        $this->eventDispatcher->dispatch(EntityGetPathEvent::EVENT_GET_PATH, $event);
        if ($path = $event->getPath()) {
            return $path;
        }

        // In most cases, this will be used for nodes only, so just set the
        // node URL.
        // It will avoid nasty bugs, since the 'text' core module does sanitize
        // (and call check_markup()) during field load if there are any circular
        // links dependencies between two nodes, it triggers an finite loop.
        // This will also make the whole faster.
        // @todo If node does not exists, no error will be triggered.
        if ('node' === $type) {
            return 'node/' . $id;
        }

        $entity = $this->entityManager->getStorage($type)->load($id);
        if (!$entity) {
            throw new \InvalidArgumentException(sprintf("entity of type %s with identifier %s does not exist", $type, $id));
        }

        if (!$entity instanceof EntityInterface) {
            return $this->getDrupalEntityPath($type, $entity);
        } else {
            return $entity->url();
        }
    }
public function getEntityPath ( $ type , $ id ) { // Allow other modules to interact $ event = new EntityGetPathEvent ( $ type , $ id ) ; $ this -> eventDispatcher -> dispatch ( EntityGetPathEvent :: EVENT_GET_PATH , $ event ) ; if ( $ path = $ event -> getPath ( ) ) { return $ path ; } // In most cases, this will be used for nodes only, so just set the // node URL. // It will avoid nasty bugs, since the 'text' core module does sanitize // (and call check_markup()) during field load if there are any circular // links dependencies between two nodes, it triggers an finite loop. // This will also make the whole faster. // @todo If node does not exists, no error will be triggered. if ( 'node' === $ type ) { return 'node/' . $ id ; } $ entity = $ this -> entityManager -> getStorage ( $ type ) -> load ( $ id ) ; if ( ! $ entity ) { throw new \ InvalidArgumentException ( sprintf ( "entity of type %s with identifier %s does not exist" , $ type , $ id ) ) ; } if ( ! $ entity instanceof EntityInterface ) { return $ this -> getDrupalEntityPath ( $ type , $ entity ) ; } else { return $ entity -> url ( ) ; } }
Get entity internal path

@param string $type
Entity type
@param int|string $id
Entity identifier

@return string
The Drupal internal path
Get entity internal path