Class

eZ\Publish\Core\Helper\PreviewLocationProvider

class PreviewLocationProvider

Provides location(s) for a content.

Handles unpublished content that does not have an actual location yet.

Methods

__construct(LocationService $locationService, ContentService $contentService, Handler $locationHandler)

Location|null loadMainLocation(mixed $contentId)

Loads the main location for $contentId.

Details

at line 35
public __construct(LocationService $locationService, ContentService $contentService, Handler $locationHandler)

Parameters

LocationService $locationService
ContentService $contentService
Handler $locationHandler

at line 57
public Location|null loadMainLocation(mixed $contentId)

Loads the main location for $contentId.

If the content does not have a location (yet), but has a Location draft, it is returned instead. Location drafts do not have an id (it is set to null), and can be tested using the isDraft() method.

If the content doesn't have a location nor a location draft, null is returned.

Parameters

mixed $contentId

Return Value

Location|null