-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflysystem_gcs_cors.module
More file actions
37 lines (32 loc) · 1.17 KB
/
flysystem_gcs_cors.module
File metadata and controls
37 lines (32 loc) · 1.17 KB
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
<?php
/**
* @file
* Contains flysystem_gcs_cors.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function flysystem_gcs_cors_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the flysystem_gcs_cors module.
case 'help.page.flysystem_gcs_cors':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Allow directly uploading to Google Cloud Storage from the web browser') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_field_info_alter().
*
* The override is intentionally global because upload validators are resolved
* from the field item class, not from just the selected widget. The replacement
* classes preserve core storage behavior and only raise the upload-size ceiling
* for fields using a Flysystem scheme configured with the GCS driver.
*/
function flysystem_gcs_cors_field_info_alter(array &$info) {
$info['file']['class'] = '\Drupal\flysystem_gcs_cors\Plugin\Field\FieldType\FlysystemGcsCorsFile';
$info['image']['class'] = '\Drupal\flysystem_gcs_cors\Plugin\Field\FieldType\FlysystemGcsCorsImage';
}