bundles/BlockManagerBundle/Templating/Twig/Runtime/ItemRuntime.php
public function getItemPath($value, ?string $valueType = null): string
    {
        try {
            $item = null;

            if (is_string($value) && $valueType === null) {
                $itemUri = parse_url($value);
                if (!is_array($itemUri) || ($itemUri['scheme'] ?? '') === '' || !isset($itemUri['host'])) {
                    throw ItemException::invalidValue($value);
                }

                $item = $this->cmsItemLoader->load(
                    $itemUri['host'],
                    str_replace('-', '_', $itemUri['scheme'])
                );
            } elseif ((is_int($value) || is_string($value)) && is_string($valueType)) {
                $item = $this->cmsItemLoader->load($value, $valueType);
            } elseif ($value instanceof CmsItemInterface) {
                $item = $value;
            }

            if (!$item instanceof CmsItemInterface) {
                throw ItemException::canNotLoadItem();
            }

            return $this->urlGenerator->generate($item);
        } catch (Throwable $t) {
            $this->errorHandler->handleError($t);
        }

        return '';
    }
public function getItemPath($value, ?string $valueType = null): string
    {
        try {
            $item = null;

            if (is_string($value) && $valueType === null) {
                $itemUri = parse_url($value);
                if (!is_array($itemUri) || ($itemUri['scheme'] ?? '') === '' || !isset($itemUri['host'])) {
                    throw ItemException::invalidValue($value);
                }

                $item = $this->cmsItemLoader->load(
                    $itemUri['host'],
                    str_replace('-', '_', $itemUri['scheme'])
                );
            } elseif ((is_int($value) || is_string($value)) && is_string($valueType)) {
                $item = $this->cmsItemLoader->load($value, $valueType);
            } elseif ($value instanceof CmsItemInterface) {
                $item = $value;
            }

            if (!$item instanceof CmsItemInterface) {
                throw ItemException::canNotLoadItem();
            }

            return $this->urlGenerator->generate($item);
        } catch (Throwable $t) {
            $this->errorHandler->handleError($t);
        }

        return '';
    }
public function getItemPath ( $ value , ? string $ valueType = null ) : string { try { $ item = null ; if ( is_string ( $ value ) && $ valueType === null ) { $ itemUri = parse_url ( $ value ) ; if ( ! is_array ( $ itemUri ) || ( $ itemUri [ 'scheme' ] ?? '' ) === '' || ! isset ( $ itemUri [ 'host' ] ) ) { throw ItemException :: invalidValue ( $ value ) ; } $ item = $ this -> cmsItemLoader -> load ( $ itemUri [ 'host' ] , str_replace ( '-' , '_' , $ itemUri [ 'scheme' ] ) ) ; } elseif ( ( is_int ( $ value ) || is_string ( $ value ) ) && is_string ( $ valueType ) ) { $ item = $ this -> cmsItemLoader -> load ( $ value , $ valueType ) ; } elseif ( $ value instanceof CmsItemInterface ) { $ item = $ value ; } if ( ! $ item instanceof CmsItemInterface ) { throw ItemException :: canNotLoadItem ( ) ; } return $ this -> urlGenerator -> generate ( $ item ) ; } catch ( Throwable $ t ) { $ this -> errorHandler -> handleError ( $ t ) ; } return '' ; }
The method returns the full path of provided item.

It accepts three kinds of references to the item:

1) URI with value_type://value format, e.g. type://42
2) ID and value type as separate arguments
3) \Netgen\BlockManager\Item\CmsItemInterface object

@param mixed $value
@param string|null $valueType

@throws \Netgen\BlockManager\Exception\Item\ItemException If provided item or item reference is not valid

@return string
The method returns the full path of provided item .