foldershare-8.x-1.2/src/Plugin/FolderShareCommand/FolderShareCommandInterface.php

src/Plugin/FolderShareCommand/FolderShareCommandInterface.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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
<?php
 
namespace Drupal\foldershare\Plugin\FolderShareCommand;
 
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Component\Plugin\ConfigurableInterface;
use Drupal\Core\Plugin\PluginFormInterface;
use Drupal\Core\Executable\ExecutableInterface;
 
/**
 * Defines an interface for plugins for commands on a shared folder.
 *
 * A command may be triggered by a user interaction with a web page via
 * AJAX, a Drupal form, a drush command line, or some other interface.
 * Commands report errors via a well-defined set of exceptions, which
 * the external trigering mechanism may turn into AJAX responses, or
 * Drupal form responses.
 *
 * Subclasses implement specific commands that use a set of parameters
 * and operate upon referenced FolderShare objects. Commands
 * could create new folders or files, delete them, move them, copy them,
 * or update them in some way.
 *
 * A command is responsible for validating parameters, performing access
 * control checks, and issuing calls to the Folder and File data models
 * to cause an operation to take place.
 *
 * @ingroup foldershare
 */
interface FolderShareCommandInterface extends PluginFormInterface, ExecutableInterface, PluginInspectionInterface, ConfigurableInterface {
 
  /*--------------------------------------------------------------------
   *
   * Constants - Special entity IDs.
   *
   *--------------------------------------------------------------------*/
 
  /**
   * Indicates that no FolderShare item ID was provided.
   *
   * Note that the Javascript UI also uses (-1) to mean an empty item ID.
   *
   * @var int
   */
  const EMPTY_ITEM_ID = (-1);
 
  /**
   * Indicates that after execution the command needs a page redirect.
   *
   * @var int
   * @see ::getExecuteBehavior()
   * @see ::getExecuteRedirectUrl()
   */
  const POST_EXECUTE_PAGE_REDIRECT = 0;
 
  /**
   * Indicates that before execution the command needs a page redirect.
   *
   * @var int
   * @see ::getExecuteBehavior()
   * @see ::getExecuteRedirectUrl()
   */
  const PRE_EXECUTE_PAGE_REDIRECT = 1;
 
  /**
   * Indicates that after execution the command needs a full page refresh.
   *
   * @var int
   * @see ::getExecuteBehavior()
   */
  const POST_EXECUTE_PAGE_REFRESH = 2;
 
  /**
   * Indicates that after execution the command needs a view refresh.
   *
   * @var int
   * @see ::getExecuteBehavior()
   */
  const POST_EXECUTE_VIEW_REFRESH = 3;
 
  /*---------------------------------------------------------------------
   *
   * Configuration forms.
   *
   *---------------------------------------------------------------------*/
 
  /**
   * Returns the translated description of the form, if any.
   *
   * @param bool $forPage
   *   Indicate whether the returned description is intended for a page
   *   (TRUE) or a dialog (FALSE).
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup[]
   *   Returns an array containing the primary and secondary description for
   *   the form. The primary description is often brief and in bold, while the
   *   secondary description provides more explanation and is not bold.
   *   The returned array may be empty if there is no description, or it may
   *   contain only a single message if there is only a primary description.
   */
  public function getDescription(bool $forPage);
 
  /**
   * Returns the translated title of the form, if any.
   *
   * @param bool $forPage
   *   Indicate whether the returned title is intended for a page
   *   (TRUE) or a dialog (FALSE).
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
   *   Returns the title for the form. Return an empty string or NULL for
   *   no title.
   */
  public function getTitle(bool $forPage);
 
  /**
   * Returns the translated name of the form's submit button, if any.
   *
   * @return \Drupal\Core\StringTranslation\TranslatableMarkup
   *   Returns the name for the submit button.
   */
  public function getSubmitButtonName();
 
  /**
   * Returns TRUE if the command has a configuration form.
   *
   * When TRUE, the class must implement the form methods of
   * PluginFormInterface, including:
   *
   * - buildConfigurationForm().
   * - validateConfigurationForm().
   * - submitConfigurationForm().
   *
   * @return bool
   *   Returns TRUE if there is a configuration form.
   *
   * @see PluginFormInterface::buildConfigurationForm()
   * @see PluginFormInterface::validateConfigurationForm()
   * @see PluginFormInterface::submitConfigurationForm()
   */
  public function hasConfigurationForm();
 
  /*---------------------------------------------------------------------
   *
   * Redirects.
   *
   *---------------------------------------------------------------------*/
 
  /**
   * Get the behavior needed before or after executing the command.
   *
   * Command processing can do one of:
   * - PRE_EXECUTE_PAGE_REDIRECT = redirect to a new page instead of execution.
   * - POST_EXECUTE_PAGE_REDIRECT = redirect to a new page.
   * - POST_EXECUTE_PAGE_REFRESH = refresh the current page entirely.
   * - POST_EXECUTE_VIEW_REFRESH = refresh the current page's view only.
   *
   * @return int
   *   Returns the behavior needed before or after executing the command.
   *
   * @see ::getExecuteRedirectUrl()
   */
  public function getExecuteBehavior();
 
  /**
   * Returns a URL for the command's redirect, if any.
   *
   * For pre- and post-execution page redirects, this method returns the
   * URL of the page to redirect to.
   *
   * @return \Drupal\Core\Url
   *   Returns the URL for the page to which the command needs to redirect.
   *
   * @see ::getExecuteBehavior()
   */
  public function getExecuteRedirectUrl();
 
  /*---------------------------------------------------------------------
   *
   * Validate.
   *
   *---------------------------------------------------------------------*/
 
  /**
   * Returns TRUE if the command's configuration has been fully validated.
   *
   * @return bool
   *   Returns TRUE if the command has been validated.
   *
   * @see ::validateConfiguration()
   * @see ::validateCommandUse();
   */
  public function isValidated();
 
  /**
   * Validates the current configuration.
   *
   * This validates, in order:
   * - The command's availability at this site.
   * - The current user.
   * - The parent folder.
   * - The selection.
   * - The destination folder.
   * - The command's custom parameters.
   *
   * If any of the above are not valid, this function throws an exception
   * with details about the problem.
   *
   * On success, this function returns and future calls to isValidated()
   * will return TRUE.
   *
   * @throws \Drupal\foldershare\Entity\Exception\ValidationException
   *   Throws a validation exception with a message describing the problem.
   * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
   *   Throws an access denied exception if an entity is disabled.
   * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
   *   Throws a not found exception if an entity is hidden or not found.
   *
   * @see ::isValidated()
   * @see ::validateCommandAllowed()
   * @see ::validateParentConstraints()
   */
  public function validateConfiguration();
 
  /**
   * Validates that the command is allowed by this site.
   *
   * The command is checked against site constraints to insure that the
   * command is available.
   *
   * An exception is thrown if the constraints are not met.
   *
   * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
   *   Throws an access denied exception if the command is not available
   *   on this site.
   *
   * @see ::validateConfiguration()
   * @see \Drupal\foldershare\Annotation\FolderShareCommand
   */
  public function validateCommandAllowed();
 
  /**
   * Validates that the current user meets command constraints.
   *
   * An exception is thrown if the constraints are not met.
   *
   * @throws \Drupal\foldershare\Entity\Exception\ValidationException
   *   Throws a validation exception with a message describing the problem.
   *
   * @see ::validateConfiguration()
   * @see \Drupal\foldershare\Annotation\FolderShareCommand
   */
  public function validateUserConstraints();
 
  /**
   * Validates that the parent meets command constraints.
   *
   * An exception is thrown if the constraints are not met.
   *
   * @throws \Drupal\foldershare\Entity\Exception\ValidationException
   *   Throws a validation exception with a message describing the problem.
   * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
   *   Throws an access denied exception if the parent entity is disabled.
   * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
   *   Throws a not found exception if the parent entity is hidden.
   *
   * @see ::validateConfiguration()
   * @see \Drupal\foldershare\Annotation\FolderShareCommand
   */
  public function validateParentConstraints();
 
  /**
   * Validates that the selection (if any) meets command constraints.
   *
   * An exception is thrown if the constraints are not met.
   *
   * This function is automatically called by validateConfiguration(),
   * but it may be called directly to validate the selection configuration only.
   *
   * @throws \Drupal\foldershare\Entity\Exception\ValidationException
   *   Throws a validation exception with a message describing the problem.
   * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
   *   Throws an access denied exception if a selected entity is disabled.
   * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
   *   Throws a not found exception if a selected entity is hidden.
   *
   * @see ::validateConfiguration()
   * @see \Drupal\foldershare\Annotation\FolderShareCommand
   */
  public function validateSelectionConstraints();
 
  /**
   * Validates that the destination (if any) meets command constraints.
   *
   * An exception is thrown if the constraints are not met.
   *
   * @throws \Drupal\foldershare\Entity\Exception\ValidationException
   *   Throws a validation exception with a message describing the problem.
   * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
   *   Throws an access denied exception if the destination entity is disabled.
   * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
   *   Throws a not found exception if the destination entity is hidden.
   *
   * @see ::validateConfiguration()
   * @see \Drupal\foldershare\Annotation\FolderShareCommand
   */
  public function validateDestinationConstraints();
 
  /**
   * Validates any additional command-specific parameters.
   *
   * An exception is thrown if the constraints are not met.
   *
   * @throws \Drupal\foldershare\Entity\Exception\ValidationException
   *   Throws a validation exception with a message describing the problem.
   *
   * @see ::validateConfiguration()
   */
  public function validateParameters();
 
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc