本文整理汇总了PHP中eZ\Publish\API\Repository\Repository::getURLAliasService方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::getURLAliasService方法的具体用法?PHP Repository::getURLAliasService怎么用?PHP Repository::getURLAliasService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZ\Publish\API\Repository\Repository
的用法示例。
在下文中一共展示了Repository::getURLAliasService方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getURLAliasService
/**
* Get URLAliasService
*
* @return \eZ\Publish\API\Repository\URLAliasService
*/
public function getURLAliasService()
{
if ($this->urlAliasService !== null) {
return $this->urlAliasService;
}
$this->urlAliasService = new URLAliasService($this->repository->getURLAliasService(), $this->signalDispatcher);
return $this->urlAliasService;
}
示例2: castLocation
public function castLocation(Location $location, array $a, Stub $stub, $isNested, $filter = 0)
{
$urlAliasService = $this->repository->getURLAliasService();
$prefix = Caster::PREFIX_PROTECTED;
if (!isset($a[$prefix . 'id'])) {
$b = (array) $location;
if (isset($b[$prefix . 'id'])) {
$a += [$prefix . 'id' => $b[$prefix . 'id']];
}
}
if ($filter & Caster::EXCLUDE_VERBOSE) {
$a[Caster::PREFIX_VIRTUAL . 'urlAlias'] = $urlAliasService->reverseLookup($location);
} else {
$urlAliases = array_merge($urlAliasService->listLocationAliases($location, false), $urlAliasService->listLocationAliases($location, true));
$locationPaths = [];
foreach ($urlAliases as $alias) {
$locationPaths[] = $alias->path;
}
$a[Caster::PREFIX_VIRTUAL . 'urlAliases'] = $locationPaths;
}
return $a;
}