foldershare-8.x-1.2/src/Constants.php
src/Constants.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 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | <?php namespace Drupal\foldershare; /** * Defines constants use through the module. * * This class defines constants for often-used text, services, libraries, * themes, permissions, routes, and so forth. In many cases, these values * repeat values defined in YML files. * * <B>Warning:</B> This class is strictly internal to the FolderShare * module. The class's existance, name, and content may change from * release to release without any promise of backwards compatability. * * @internal * Routes, permissions, themes, libraries, and many other names are * defined in the module's many ".yml" files. These same names are needed * at run-time to refer to the defined routes, permissions, etc. * * While many YML-defined values are available at run-time via the * Drupal API, they are often referenced via name. This forces these * name strings to be embedded in the code. * * Frequent use of important hard-coded strings invites typos that can * cause routes, permissions, settings, and other values to not line up * with their intended targets. To reduce the effect of typos, and centralize * common names, these are all defined here in a module-wide list of * constants. Module code uses these constants by name, rather than * hard-coding typo-risky strings. This turns these strings into syntactic * objects in PHP, which the PHP parser can catch and report as errors if * typos creep in. * @endinternal * * @ingroup foldershare */ final class Constants { /*-------------------------------------------------------------------- * * Administration. * *--------------------------------------------------------------------*/ /** * The module machine name. * * This must match all uses of the module name: * * - The name of the module directory. * - The name of the "MODULE.module" file. * - The machine name in "MODULE.info.yml". * - The name of the \Drupal\MODULE namespace for the module. * * This module name should be used as the prefix for names that * have global scope, such as tables, settings, and routes. * * The module name should be used as a prefix for CSS classes * and IDs, and as the name of the module's function group in * Javascript. * * @var string */ const MODULE = 'foldershare' ; /** * The module's settings (configuration) name. * * This must match the configuration name in "MODULE.info.yml'. * * This must match the file name and settings group in * 'config/schema/MODULE.settings.yml'. It also must match the * file name in 'install/MODULE.settings.yml'. * * @var string */ const SETTINGS = 'foldershare.settings' ; /** * The module's search index name. * * This must match the name in the "FolderSearch" plugin's annotation. * * This must match the name of the search page configuration in * 'config/optional/search.page.SEARCH_INDEX.yml'. * * This search index only exists if the Drupal core search module * is enabled. * * @var string */ const SEARCH_INDEX = 'foldershare_search' ; /*-------------------------------------------------------------------- * * Libraries. * *--------------------------------------------------------------------*/ /** * The module primary library. * * This must match the library in 'MODULE.libraries.yml'. * * @var string */ const LIBRARY_MODULE = 'foldershare/foldershare.module' ; /** * The module administration pages library. * * This must match the library in 'MODULE.libraries.yml'. * * @var string */ const LIBRARY_ADMIN = 'foldershare/foldershare.module.admin' ; /** * The module field formatter library. * * This must match the library in 'MODULE.libraries.yml'. * * @var string */ const LIBRARY_FIELD_FORMATTER = 'foldershare/foldershare.fieldformatter' ; /*-------------------------------------------------------------------- * * Routes and route parameters. * * These constants define well-known module routes. All values must * match those in 'MODULE.routing.yml'. * *--------------------------------------------------------------------*/ /** * The route to a FolderShare entity view page. * * The route has a numeric FolderShare ID parameter. * * This must match the route in 'MODULE.routing.yml'. * * @var string * @see self::ROUTE_FOLDERSHARE_ID */ const ROUTE_FOLDERSHARE = 'entity.foldershare.canonical' ; /** * The route to the user's personal and shared-with-them root item list. * * This must match the route in 'MODULE.routing.yml'. * * @var string */ const ROUTE_ROOT_ITEMS_PERSONAL = 'entity.foldershare.rootitems' ; /** * The route to the site's public root item list. * * This must match the route in 'MODULE.routing.yml'. * * @var string */ const ROUTE_ROOT_ITEMS_PUBLIC = 'entity.foldershare.rootitems.public' ; /** * The route to the site admin's root item list of everything. * * This must match the route in 'MODULE.routing.yml'. * * @var string */ const ROUTE_ROOT_ITEMS_ALL = 'entity.foldershare.rootitems.all' ; /** * The route to a FolderShare entity edit page. * * The route has a numeric FolderShare ID parameter. * * This must match the route in 'MODULE.routing.yml'. * * @var string * @see self::ROUTE_FOLDERSHARE_ID */ const ROUTE_FOLDERSHARE_EDIT = 'entity.foldershare.edit' ; /** * The FolderShare view and edit route parameter for an entity ID. * * @var string */ const ROUTE_FOLDERSHARE_ID = 'foldershare' ; /** * The UI's command route to command-specific forms. * * @var string */ const ROUTE_FOLDERSHARE_COMMAND_FORM = 'entity.foldersharecommand.plugin' ; /** * The route to the settings page. * * This must match the route in 'MODULE.routing.yml', * 'foldershare.links.menu.yml', and 'MODULE.links.task.yml'. * * @var string */ const ROUTE_SETTINGS = 'entity.foldershare.settings' ; /** * The route to the file download handler. * * An argument 'file' must contain the entity ID of a File object wrapped * by a FolderShare entity. * * The route may include one or more query arguments. If present, the * 'foldershareprefix' query argument contains a string containing the * URL path prefix to prepend to the incoming file URI to generate a * redirect URL and return to whatever URL processing another * module (such as Image) may require for derived paths. * * Any other query and fragment arguments are passed along on the * redirect. * * This must match the route in 'MODULE.routing.yml'. * * @var string */ const ROUTE_DOWNLOADFILE = 'entity.foldershare.file' ; /** * The query name for a path prefix for the file download handler. * * @var string */ const ROUTE_DOWNLOADFILE_PREFIX = 'foldershareprefix' ; /** * The route to the entity download handler. * * The argument 'encoded' must contain a JSON base64 array containing * FolderShare entity IDs to download. They must all be children of * the same parent. * * This must match the route in 'MODULE.routing.yml'. * * @var string */ const ROUTE_DOWNLOAD = 'entity.foldershare.download' ; /** * The route to the usage page. * * This must match the route in 'MODULE.routing.yml'. * * @var string */ const ROUTE_USAGE = 'foldershare.reports.usage' ; /** * The route to the views UI page listing views. * * @var string */ const ROUTE_VIEWS_UI = 'entity.view.collection' ; /** * The base route to the views UI page for a specific view. * * The name of the view to edit must be in the "view" parameter. * * @var string */ const ROUTE_VIEWS_UI_VIEW = 'entity.view.edit_form' ; /*-------------------------------------------------------------------- * * Services. * *--------------------------------------------------------------------*/ /** * The service that keeps track of folder command plugins. * * This must match the route in 'MODULE.services.yml'. * * @var string */ const SERVICE_FOLDERSHARECOMMANDS = 'foldershare.plugin.manager.foldersharecommand' ; /*-------------------------------------------------------------------- * * Plugins. * *--------------------------------------------------------------------*/ /** * The name of the module's search plugin for Drupal core Search. * * This name must match the ID for the search plugin. * * @var string */ const SEARCH_PLUGIN = 'foldershare_search' ; /** * The name of the module's internal name field formatter plugin. * * This name must match the ID of the internal plugin. * * @var string */ const INTERNAL_NAME_FORMATTER = 'foldershare_internal_name' ; /** * The name of the module's internal folder name field formatter plugin. * * This name must match the ID of the internal plugin. * * @var string */ const INTERNAL_FOLDER_NAME_FORMATTER = 'foldershare_internal_folder_name' ; /*-------------------------------------------------------------------- * * Views and their displays. * * These constants define the names of module-installed views. * *--------------------------------------------------------------------*/ /** * The view creating all lists of files and folders. * * The name must match the machine name of the "FolderShare Lists" view. * * @var string */ const VIEW_LISTS = 'foldershare_lists' ; /** * The view display listing all root items for any user. * * Used for the 'All files' list available to admins. * * The name must match the machine name of the "FolderShare Lists" view * and its "List all" display. * * @var string */ const VIEW_DISPLAY_LIST_ALL = 'list_all' ; /** * The view display listing root items owned by or shared with a user. * * Used for the 'Personal files' list. * * The name must match the machine name of the "FolderShare Lists" view * and its "List personal" display. * * @var string */ const VIEW_DISPLAY_LIST_PERSONAL = 'list_personal' ; /** * The view display listing root items owned by or shared with anonymous. * * Used for the 'Public files' list. * * The name must match the machine name of the "FolderShare Lists" view * and its "List public" display. * * @var string */ const VIEW_DISPLAY_LIST_PUBLIC = 'list_public' ; /** * The view display listing folder contents available to the user. * * Used for the folder contents list on entity view pages. * * The name must match the machine name of the "FolderShare Lists" view * and its "List folder" display. * * @var string */ const VIEW_DISPLAY_LIST_FOLDER = 'list_folder' ; /** * The view display dialog listing all root items for any user. * * Used for the 'All files' list in dialogs. * * The name must match the machine name of the "FolderShare Lists" view * and its "Dialog all" display. * * @var string */ const VIEW_DISPLAY_DIALOG_ALL = 'dialog_all' ; /** * The view display dialog listing root items owned by or shared with a user. * * Used for the 'Personal files' list in dialogs. * * The name must match the machine name of the "FolderShare Lists" view * and its "Dialog personal" display. * * @var string */ const VIEW_DISPLAY_DIALOG_PERSONAL = 'dialog_personal' ; /** * The view display dialog listing root items owned by/shared with anonymous. * * Used for the 'Public files' list in dialogs. * * The name must match the machine name of the "FolderShare Lists" view * and its "Dialog public" display. * * @var string */ const VIEW_DISPLAY_DIALOG_PUBLIC = 'dialog_public' ; /** * The view display dialog listing folder contents available to the user. * * Used for the folder contents list in dialogs. * * The name must match the machine name of the "FolderShare Lists" view * and its "Dialog folder" display. * * @var string */ const VIEW_DISPLAY_DIALOG_FOLDER = 'dialog_folder' ; /*-------------------------------------------------------------------- * * Tokens. * *--------------------------------------------------------------------*/ /** * The name of the token group for folder fields. * * The name should match FolderShare::ENTITY_TYPE_ID. * * @var string */ const FOLDERSHARE_TOKENS = 'foldershare' ; /*-------------------------------------------------------------------- * * Themes. * *--------------------------------------------------------------------*/ /** * The folder page theme. * * This must match a theme name in the module's templates directory. * The theme file must be named: * THEME_FOLDER . 'html.twig'. * * This name also must match the theme template function * template_preprocess_THEME_ROOT_LIST in MODULE.module. * * @var string */ const THEME_FOLDER = 'foldershare' ; /** * The view (list) page theme. * * This must match a theme name in the module's templates directory. * The theme file must be named: * THEME_VIEW . 'html.twig'. * * This name also must match the theme template function * template_preprocess_THEME_ROOT_LIST in MODULE.module. * * @var string */ const THEME_VIEW = 'foldershare_view' ; /*-------------------------------------------------------------------- * * Role-based permissions. * * These constants define well-known module permissions names. Their * values must match those in 'MODULE.permissions.yml'. * *--------------------------------------------------------------------*/ /** * The module's administrative permission. * * Users may create, delete, and modify all content by any user, change * ownership, and adjust share settings. They cannot change module settings. * * This must much the administer permission in 'MODULE.permissions.yml'. * * @var string */ const ADMINISTER_PERMISSION = 'administer foldershare' ; /** * The module's share with other users permission. * * Users may share root items with other specific users, granting them * view and/or author access. * * This must much the author permission in 'MODULE.permissions.yml'. * * @var string */ const SHARE_PERMISSION = 'share foldershare' ; /** * The module's share with public permission. * * Users may share root items with the anonymous user, making the content * public and accessible by site visitors without accounts. Anonymous users * may only be granted view access. * * This must much the author permission in 'MODULE.permissions.yml'. * * @var string */ const SHARE_PUBLIC_PERMISSION = 'share public foldershare' ; /** * The module's author permission. * * Users may create, delete, and modify their own content, and * content owned by others if they have been granted author access. * * This must much the author permission in 'MODULE.permissions.yml'. * * @var string */ const AUTHOR_PERMISSION = 'author foldershare' ; /** * The module's view permission. * * Users may view their own content, and content owned by others if * granted view access. * * This must much the view permission in 'MODULE.permissions.yml'. * * @var string */ const VIEW_PERMISSION = 'view foldershare' ; /*-------------------------------------------------------------------- * * UI feature flags. * *--------------------------------------------------------------------*/ /** * Indicates whether to include the command menu in the UI. * * The command menu lists command plugins (e.g. "Delete", "Copy", "Move") * in a pull-down menu attached to the toolbar above a folder table listing, * or stand-alone on a file page. Along with the command menu, Javascript * provides: * - Table row selection. * - Drag-and-drop on table rows for copy and move. * - Drag-and-drop of files into a table for upload. * - A file dialog for selecting files to upload. * - Dynamic enable/disable of commands based upon the selection. * - Command pre-validation before execution. * * When this flag is TRUE, the command menu is included. When FALSE, * it is not. Without the menu, however, no commands may be executed * and it is not possible to create folders, upload files, delete, copy, * move, etc. * * This flag is normally TRUE, but it can be set to FALSE to help * debug the user interface. * * @var bool */ const ENABLE_UI_COMMAND_MENU = TRUE; /** * Indicates whether to include the ancestor menu in the UI. * * The ancestor menu lists links to ancestor folders, starting with the * current item and continuing up to its root folder and list of root * folders. The ancestor list is in a pull-down menu attached to the * toolbar above a folder table listing, or stand-alone on a file page. * * When this flag is TRUE, the ancestor menu is included. When FALSE, * it is not. Without the menu, however, navigating upwards through the * folder tree must be done using breadcrumb links (if included on a page), * the path pseudo-field (if included on a page), or by clicking on a root * list page link and navigating downwards only. * * This flag is normally TRUE, but it can be set to FALSE to help * debug the user interface. * * @var bool */ const ENABLE_UI_ANCESTOR_MENU = TRUE; /** * Indicates whether to include the search box in the UI. * * The search UI includes a search box and a search submit button. * If the browser supports Javascript, the submit button is hidden and * a behavior on the search box triggers a search on a carriage return. * These widgets are attached to the toolbar above a folder table listing. * They are not present on a file page. * * The Drupal core Search module must be enabled, FolderShare's search * plugin must be available, and the current user must have the "Use search" * permission. If any of these are not true, the search UI widgets are * not included even if this flag is TRUE. * * When this flag is TRUE, these UI widgets are included. When FALSE, * they are not. Without these widgets, however, folder search can be * initiated only site-wide using a site's search features (if available). * Folder tree-specific search is not available. * * This flag is normally TRUE, but it can be set to FALSE to help * debug the user interface. * * @var bool */ const ENABLE_UI_SEARCH_BOX = TRUE; /** * Indicates whether to enable AJAX command dialogs in the UI. * * When TRUE, the user interface uses AJAX to enable on-page command forms * within dialog boxes. When FALSE, command forms are on separate pages, * instead of on-page dialogs. * * This flag is normally TRUE, but it can be set to FALSE to help * debug the user interface. * * <B>The UI is not guaranteed to fully work without dialogs. The dialog * version of the UI is the primary version and the most fully supported.</B> * * @var bool */ const ENABLE_UI_COMMAND_DIALOGS = TRUE; } |