Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Core/MVC/Symfony/Matcher/ContentBased/Identifier/ContentType.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Identifier;
8
9 use eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued;
10 use eZ\Publish\API\Repository\Values\Content\Location;
11 use eZ\Publish\API\Repository\Values\Content\ContentInfo;
12 use eZ\Publish\Core\MVC\Symfony\View\ContentValueView;
13 use eZ\Publish\Core\MVC\Symfony\View\View;
14
15 class ContentType extends MultipleValued
16 {
24 public function matchLocation(Location $location)
25 {
26 $contentType = $this->repository
27 ->getContentTypeService()
28 ->loadContentType($location->getContentInfo()->contentTypeId);
29
30 return isset($this->values[$contentType->identifier]);
31 }
32
40 public function matchContentInfo(ContentInfo $contentInfo)
41 {
42 $contentType = $this->repository
43 ->getContentTypeService()
44 ->loadContentType($contentInfo->contentTypeId);
45
46 return isset($this->values[$contentType->identifier]);
47 }
48
49 public function match(View $view)
50 {
51 if (!$view instanceof ContentValueView) {
52 return false;
53 }
54
55 $contentType = $this->repository
56 ->getContentTypeService()
57 ->loadContentType($view->getContent()->contentInfo->contentTypeId);
58
59 return isset($this->values[$contentType->identifier]);
60 }
61 }
eZ\Publish\API\Repository\Values\Content\ContentInfo
Definition: API/Repository/Values/Content/ContentInfo.php:31
eZ\Publish\API\Repository\Values\Content\Location
Definition: API/Repository/Values/Content/Location.php:32
eZ\Publish\API\Repository\Values\Content\Location\getContentInfo
getContentInfo()
Returns the content info of the content object of this location.
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Identifier\ContentType\matchLocation
matchLocation(Location $location)
Checks if a Location object matches.
Definition: Core/MVC/Symfony/Matcher/ContentBased/Identifier/ContentType.php:24
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Identifier\ContentType\match
match(View $view)
Matches the $view against a set of matchers.
Definition: Core/MVC/Symfony/Matcher/ContentBased/Identifier/ContentType.php:49
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Identifier\ContentType\matchContentInfo
matchContentInfo(ContentInfo $contentInfo)
Checks if a ContentInfo object matches.
Definition: Core/MVC/Symfony/Matcher/ContentBased/Identifier/ContentType.php:40
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued
Abstract class for basic matchers, accepting multiple values to match against.
Definition: ContentBased/MultipleValued.php:15
eZ\Publish\Core\MVC\Symfony\View\ContentValueView
A view that contains a Content.
Definition: ContentValueView.php:13
eZ\Publish\Core\MVC\Symfony\View\View
Main interface for Views of Value objects (content, block...).
Definition: Publish/Core/MVC/Symfony/View/View.php:16
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Identifier
Definition: Core/MVC/Symfony/Matcher/ContentBased/Identifier/ContentType.php:7
eZ\Publish\SPI\Persistence\Content\Type
Definition: SPI/Persistence/Content/Type/CreateStruct.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.