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

PageProcessor.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Common\FieldTypeProcessor;
8
9 use eZ\Publish\Core\REST\Common\FieldTypeProcessor;
10 use eZ\Publish\Core\FieldType\Page\Parts\Base;
11
12 class PageProcessor extends FieldTypeProcessor
13 {
17 public function preProcessValueHash($incomingValueHash)
18 {
19 if (isset($incomingValueHash['zones'])) {
20 foreach ($incomingValueHash['zones'] as &$zone) {
21 if (isset($zone['action'])) {
22 $zone['action'] = $this->getConstantValue($zone['action']);
23 }
24
25 if (!isset($zone['blocks'])) {
26 continue;
27 }
28
29 foreach ($zone['blocks'] as &$block) {
30 if (isset($block['action'])) {
31 $block['action'] = $this->getConstantValue($block['action']);
32 }
33
34 if (!isset($block['items'])) {
35 continue;
36 }
37
38 foreach ($block['items'] as &$item) {
39 if (isset($item['action'])) {
40 $item['action'] = $this->getConstantValue($item['action']);
41 }
42 }
43 }
44 }
45 }
46
47 return $incomingValueHash;
48 }
49
53 public function postProcessValueHash($outgoingValueHash)
54 {
55 if (isset($outgoingValueHash['zones'])) {
56 foreach ($outgoingValueHash['zones'] as &$zone) {
57 if (isset($zone['action'])) {
58 $zone['action'] = $this->getConstantName($zone['action']);
59 }
60
61 if (!isset($zone['blocks'])) {
62 continue;
63 }
64
65 foreach ($zone['blocks'] as &$block) {
66 if (isset($block['action'])) {
67 $block['action'] = $this->getConstantName($block['action']);
68 }
69
70 if (!isset($block['items'])) {
71 continue;
72 }
73
74 foreach ($block['items'] as &$item) {
75 if (isset($item['action'])) {
76 $item['action'] = $this->getConstantName($item['action']);
77 }
78 }
79 }
80 }
81 }
82
83 return $outgoingValueHash;
84 }
85
91 protected function getConstantValue($name)
92 {
93 switch ($name) {
94 case 'ACTION_ADD':
95 return Base::ACTION_ADD;
96 case 'ACTION_MODIFY':
97 return Base::ACTION_MODIFY;
98 case 'ACTION_REMOVE':
99 return Base::ACTION_REMOVE;
100 }
101
102 return $name;
103 }
104
110 protected function getConstantName($value)
111 {
112 switch ($value) {
113 case Base::ACTION_ADD:
114 return 'ACTION_ADD';
115 case Base::ACTION_MODIFY:
116 return 'ACTION_MODIFY';
117 case Base::ACTION_REMOVE:
118 return 'ACTION_REMOVE';
119 }
120
121 return $value;
122 }
123 }
eZ\Publish\Core\FieldType\Page\Parts\Base
Definition: FieldType/Page/Parts/Base.php:12
eZ\Publish\Core\REST\Common\FieldTypeProcessor\PageProcessor
Definition: PageProcessor.php:13
eZ\Publish\Core\REST\Common\FieldTypeProcessor\PageProcessor\getConstantValue
getConstantValue($name)
Definition: PageProcessor.php:91
eZ\Publish\Core\REST\Common\FieldTypeProcessor\PageProcessor\postProcessValueHash
postProcessValueHash($outgoingValueHash)
{Perform manipulations on an a generated $outgoingValueHash.This method is called by the REST output ...
Definition: PageProcessor.php:53
eZ\Publish\Core\REST\Common\FieldTypeProcessor\PageProcessor\preProcessValueHash
preProcessValueHash($incomingValueHash)
{Perform manipulations on a received $incomingValueHash.This method is called by the REST input parse...
Definition: PageProcessor.php:17
eZ\Publish\Core\REST\Common\FieldTypeProcessor\PageProcessor\getConstantName
getConstantName($value)
Definition: PageProcessor.php:110
eZ\Publish\Core\REST\Common\FieldTypeProcessor
FieldTypeProcessor.
Definition: FieldTypeProcessor.php:13
eZ\Publish\Core\REST\Common\FieldTypeProcessor
Definition: AuthorProcessor.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.