-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzip_field_files.module
More file actions
40 lines (36 loc) · 1.6 KB
/
zip_field_files.module
File metadata and controls
40 lines (36 loc) · 1.6 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
38
39
40
<?php
/**
* @file
* Hook implementations and some functions.
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Hook\Attribute\LegacyHook;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Drupal\zip_field_files\Hook\FormHooks;
/**
* Implements HOOK_help().
*/
function zip_field_files_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the block module.
case 'help.page.zip_field_files':
return '<p>' . t('Provides an link for download all files of an field as zip file. In the <a href="@settings">Zip Field Files administration page</a> you can config some options including the file name and its persistence on the file system.', [
'@settings' => Url::fromRoute('zip_field_files.settings')->toString(),
]) . '</p>';
// Help for another path in the block module.
case 'zip_field_files.settings':
$help_text[] = '<p>' . t('This page provides a interface for config config some options of Zip Field Files module including the file name and its persistence on the file system.') . '</p>';
$help_text[] = '<p>' . t('Remember to set the Format Options: "ZIP file" for the field you want to use.') . '</p>';
return implode('', $help_text);
}
}
/**
* Implements hook_form_FORM_ID_alter().
*/
#[LegacyHook]
function zip_field_files_form_field_config_edit_form_alter(array &$form, FormStateInterface $form_state, string $form_id): void {
$hooks = \Drupal::service(FormHooks::class);
assert($hooks instanceof FormHooks);
$hooks->formFieldConfigEditFormAlter($form, $form_state, $form_id);
}