12

Load Location / Content by URL Alias in eZ Platform

 3 years ago
source link: https://www.symfony.fi/ez-platform-tip/load-location-content-by-url-alias-in-ez-platform
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Load Location / Content by URL Alias in eZ Platform

Loading content by a URL alias is done using the URL Alias Service. To get the location and content you will need to do that manually as well. See example below:

$urlAliasService = $this->container->get('ezpublish.api.service.url_alias');
$locationService = $this->container->get('ezpublish.api.service.location');

$urlAlias = $urlAliasService->lookup('/blog');
$location = $locationService->loadLocation($urlAlias->destination);
$content = $location->getContent();

Written by Jani Tarvainen on Monday February 18, 2019
Permalink -

« Convert RichText to HTML in PHP API -


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK