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

Server/Output/ValueObjectVisitor/ContentTypeList.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor;
8
9 use eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor;
10 use eZ\Publish\Core\REST\Common\Output\Generator;
11 use eZ\Publish\Core\REST\Common\Output\Visitor;
12 use eZ\Publish\Core\REST\Server\Values;
13
17 class ContentTypeList extends ValueObjectVisitor
18 {
26 public function visit(Visitor $visitor, Generator $generator, $data)
27 {
28 $generator->startObjectElement('ContentTypeList');
29 $visitor->setHeader('Content-Type', $generator->getMediaType('ContentTypeList'));
30 //@todo Needs refactoring, disabling certain headers should not be done this way
31 $visitor->setHeader('Accept-Patch', false);
32
33 $generator->startAttribute('href', $data->path);
34 $generator->endAttribute('href');
35
36 $generator->startList('ContentType');
37 foreach ($data->contentTypes as $contentType) {
38 $visitor->visitValueObject(
39 new Values\RestContentType(
40 $contentType,
41 $contentType->getFieldDefinitions()
42 )
43 );
44 }
45 $generator->endList('ContentType');
46
47 $generator->endObjectElement('ContentTypeList');
48 }
49 }
eZ\Publish\Core\REST\Common\Output\Generator
Output generator.
Definition: REST/Common/Output/Generator.php:13
eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor
Basic ValueObjectVisitor.
Definition: ValueObjectVisitor.php:18
eZ\Publish\Core\REST\Common\Output\Visitor
Visits a value object into an HTTP Response.
Definition: Visitor.php:15
eZ\Publish\Core\REST\Common\Output\Visitor\visitValueObject
visitValueObject($data)
Visit struct returned by controllers.
Definition: Visitor.php:131
eZ\Publish\Core\REST\Common\Output\Visitor\setHeader
setHeader($name, $value)
Set HTTP response header.
Definition: Visitor.php:64
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeList
ContentTypeList value object visitor.
Definition: Server/Output/ValueObjectVisitor/ContentTypeList.php:18
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\ContentTypeList\visit
visit(Visitor $visitor, Generator $generator, $data)
Visit struct returned by controllers.
Definition: Server/Output/ValueObjectVisitor/ContentTypeList.php:26
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\RestContentType
RestContentType value object visitor.
Definition: Output/ValueObjectVisitor/RestContentType.php:18
eZ\Publish\Core\REST\Common\Output\ValueObjectVisitor
Definition: Common/Output/ValueObjectVisitor/ContentObjectStates.php:7
eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor
Definition: Output/ValueObjectVisitor/BadRequestException.php:7
eZ\Publish\Core\REST\Server\Values
Definition: Core/REST/Server/Values/BookmarkList.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.