Elgg  Version 6.0
PrepareSecurityTxt.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Elgg\Forms;
4 
11 
19  public function __invoke(\Elgg\Event $event): array {
20  $body_vars = $event->getValue();
21 
22  $fields = [
23  'contact',
24  'expires',
25  'encryption',
26  'acknowledgments',
27  'language',
28  'canonical',
29  'policy',
30  'hiring',
31  'csaf',
32  ];
33  foreach ($fields as $field) {
34  $body_vars[$field] = elgg_extract($field, $body_vars, elgg_get_config("security_txt_{$field}"));
35  }
36 
37  return $body_vars;
38  }
39 }
Prepare the form fields for admin/security/security_txt.
elgg_get_config(string $name, $default=null)
Get an Elgg configuration value.
if(elgg_extract('input_type', $vars)) if(elgg_extract('required', $vars)) if(elgg_extract('disabled', $vars)) $field
Definition: field.php:42
__invoke(\Elgg\Event $event)
Prepare the form fields.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:254
$fields
Save the configuration of the security.txt contents.
Definition: security_txt.php:6
$body_vars
Models an event passed to event handlers.
Definition: Event.php:11