Atualizar src/Admin/SettingsPage.php

This commit is contained in:
Brasdrive 2025-11-04 23:13:09 -04:00
parent 192ef016e6
commit d434c4d094
1 changed files with 291 additions and 271 deletions

View File

@ -188,7 +188,10 @@ class SettingsPage
<form method="post" action="options.php">
<?php
settings_fields('flysystem_offload');
do_settings_sections('flysystem-offload');
$sectionsHtml = $this->generateSectionsMarkup();
echo $sectionsHtml; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
submit_button(__('Guardar cambios', 'flysystem-offload'));
?>
</form>
@ -196,6 +199,23 @@ class SettingsPage
<?php
}
private function generateSectionsMarkup(): string
{
ob_start();
do_settings_sections('flysystem-offload');
$html = ob_get_clean();
$label = preg_quote(__('Amazon S3 / Compatible', 'flysystem-offload'), '/');
$pattern = '/(<h2[^>]*>\s*' . $label . '\s*<\/h2>\s*<table[^>]*>.*?<\/table>)/is';
return preg_replace(
$pattern,
'<div class="flysystem-offload-adapter-section" data-adapter="s3">$1</div>',
$html
);
}
public function renderAdapterField(): void
{
$settings = get_option('flysystem_offload_settings', []);