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

Core/MVC/Symfony/Matcher/ContentBased/Identifier/Section.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\Repository;
11 use eZ\Publish\API\Repository\Values\Content\Location;
12 use eZ\Publish\API\Repository\Values\Content\ContentInfo;
13 use eZ\Publish\Core\MVC\Symfony\View\ContentValueView;
14 use eZ\Publish\Core\MVC\Symfony\View\View;
15
16 class Section extends MultipleValued
17 {
25 public function matchLocation(Location $location)
26 {
27 $section = $this->repository->sudo(
28 function (Repository $repository) use ($location) {
29 return $repository->getSectionService()->loadSection(
30 $location->getContentInfo()->sectionId
31 );
32 }
33 );
34
35 return isset($this->values[$section->identifier]);
36 }
37
45 public function matchContentInfo(ContentInfo $contentInfo)
46 {
47 $section = $this->repository->sudo(
48 function (Repository $repository) use ($contentInfo) {
49 return $repository->getSectionService()->loadSection(
50 $contentInfo->sectionId
51 );
52 }
53 );
54
55 return isset($this->values[$section->identifier]);
56 }
57
58 public function match(View $view)
59 {
60 if (!$view instanceof ContentValueView) {
61 return false;
62 }
63
64 $contentInfo = $view->getContent()->contentInfo;
65 $section = $this->repository->sudo(
66 function (Repository $repository) use ($contentInfo) {
67 return $repository->getSectionService()->loadSection(
68 $contentInfo->sectionId
69 );
70 }
71 );
72
73 return isset($this->values[$section->identifier]);
74 }
75 }
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\RepositoryAware\$repository
$repository
Definition: RepositoryAware.php:14
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Identifier\Section
Definition: Core/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php:17
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Identifier\Section\matchContentInfo
matchContentInfo(ContentInfo $contentInfo)
Checks if a ContentInfo object matches.
Definition: Core/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php:45
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Identifier\Section\matchLocation
matchLocation(Location $location)
Checks if a Location object matches.
Definition: Core/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php:25
eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Identifier\Section\match
match(View $view)
Matches the $view against a set of matchers.
Definition: Core/MVC/Symfony/Matcher/ContentBased/Identifier/Section.php:58
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\API\Repository\Repository
Repository interface.
Definition: API/Repository/Repository.php:16
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
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.