I thought I could just do something like this...
Code: Select all
static public function getSubscribedEvents()
{
return [
'core.validate_config_variable' => 'validate_config_variable'
];
}
Code: Select all
public function validate_config_variable($event)
{
$input = $event['cfg_array']['s3_aws_access_key_id'];
// Check if the validate test is for s3.
if (($event['config_definition']['validate'] == 's3_aws_access_key_id') && ($input !== '')) {
// Store the error and input event data.
$error = $event['error'];
// Add error message if the input is not a valid AWS Access Key Id.
if (!preg_match('/[A-Z0-9]{20})/', $input)) {
$error[] = $this->user->lang('ACP_S3_AWS_ACCESS_KEY_ID_INVALID', $input);
}
// Update error event data.
$event['error'] = $error;
}
}
If you'd like to see the rest of the code, it is located here: https://github.com/AustinMaddox/phpbb-extension-s3