/
ClonerOptions.php
253 lines (221 loc) · 5.02 KB
/
ClonerOptions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<?php
namespace Concrete\Core\Page;
use Concrete\Core\User\User;
/**
* A class representing the options for the page/collection/version Cloner.
*
* @since concrete5 8.5.0a2
*/
class ClonerOptions
{
/**
* The currently logged in user.
*
* @var \Concrete\Core\User\User
*/
protected $currentUser;
/**
* Should the original author be kept?
*
* @var bool
*/
private $keepOriginalAuthor = false;
/**
* Mark the copied data as not approved?
*
* @var bool
*/
private $forceUnapproved = false;
/**
* Should the collection version attributes be copied?
*
* @var bool
*/
private $copyAttributes = true;
/**
* Should the page type composer output block records be copied?
*
* @var bool
*/
private $copyPageTypeComposerOutputBlocks = true;
/**
* Should the custom theme styles be copied?
*
* @var bool
*/
private $copyCustomStyles = true;
/**
* Should the collection version contents (blocks/areas/...) be copied?
*
* @var bool
*/
private $copyContents = true;
/**
* The version comments (if empty string, automatically build them).
*
* @var string
*/
private $versionComments = '';
/**
* Initialize the instance.
*
* @param \Concrete\Core\User\User $currentUser the currently logged in user
*/
public function __construct(User $currentUser)
{
$this->currentUser = $currentUser;
}
/**
* Get the currently logged in user.
*
* @return \Concrete\Core\User\User
*/
public function getCurrentUser()
{
return $this->currentUser;
}
/**
* Should the original author be kept?
*
* @return bool
*/
public function keepOriginalAuthor()
{
return $this->keepOriginalAuthor;
}
/**
* Should the original author be kept?
*
* @param bool $value
*
* @return $this
*/
public function setKeepOriginalAuthor($value)
{
$this->keepOriginalAuthor = (bool) $value;
return $this;
}
/**
* Mark the copied data as not approved?
*
* @return bool
*/
public function forceUnapproved()
{
return $this->forceUnapproved;
}
/**
* Mark the copied data as not approved?
*
* @param bool $value
*
* @return $this
*/
public function setForceUnapproved($value)
{
$this->forceUnapproved = (bool) $value;
return $this;
}
/**
* Should the collection version attributes be copied?
*
* @return bool
*/
public function copyAttributes()
{
return $this->copyAttributes;
}
/**
* Should the collection version attributes be copied?
*
* @param bool $value
*
* @return $this
*/
public function setCopyAttributes($value)
{
$this->copyAttributes = (bool) $value;
return $this;
}
/**
* Should the page type composer output block records be copied?
*
* @return bool
*/
public function copyPageTypeComposerOutputBlocks()
{
return $this->copyPageTypeComposerOutputBlocks;
}
/**
* Should the page type composer output block records be copied?
*
* @param bool $copyPageTypeComposerOutputBlocks
*/
public function setCopyPageTypeComposerOutputBlocks($copyPageTypeComposerOutputBlocks)
{
$this->copyPageTypeComposerOutputBlocks = (bool) $copyPageTypeComposerOutputBlocks;
}
/**
* Should the custom theme styles be copied?
*
* @return bool
*/
public function copyCustomStyles()
{
return $this->copyCustomStyles;
}
/**
* Should the custom theme styles be copied?
*
* @param bool $value
*
* @return $this
*/
public function setCopyCustomStyles($value)
{
$this->copyCustomStyles = (bool) $value;
return $this;
}
/**
* Should the collection version contents (blocks/areas/...) be copied?
*
* @return bool
*/
public function copyContents()
{
return $this->copyContents;
}
/**
* Should the collection version contents (blocks/areas/...) be copied?
*
* @param bool $value
*
* @return $this
*/
public function setCopyContents($value)
{
$this->copyContents = (bool) $value;
return $this;
}
/**
* Get the version comments (if empty string, automatically build it).
*
* @var string
*/
public function getVersionComments()
{
return $this->versionComments;
}
/**
* Set the version comments (if empty string, automatically build it).
*
* @param string|object $value a string value, or an object implementing the __toString() method
*
* @return $this
*/
public function setVersionComments($value)
{
$this->versionComments = (string) $value;
return $this;
}
}