feat: Tools tab without the code-module note; direct counter only as a warning above 25

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 18:57:26 +02:00
co-authored by Claude Opus 5.5
parent 314b3d0756
commit 22c4cc1264
2 changed files with 18 additions and 28 deletions
+12 -22
View File
@@ -75,7 +75,7 @@ final class ToolsTab implements AdminTab
$groups = $this->registry->grouped();
$labels = $this->registry->labels();
$this->renderIntro(isset($groups['divi']));
$this->renderIntro();
$this->renderCounter(count($policy->directNames($this->registry->abilities())));
// Lets WordPress' postbox script remember which groups each user closed.
@@ -95,7 +95,7 @@ final class ToolsTab implements AdminTab
echo '</form>';
}
private function renderIntro(bool $diviAvailable): void
private function renderIntro(): void
{
echo '<p class="description">'
. esc_html__('Lege fest, welche Tools Claude nutzen kann.', 'wp-lit-mcp') . ' '
@@ -114,35 +114,25 @@ final class ToolsTab implements AdminTab
printf('<dt>%s</dt><dd>%s</dd>', esc_html($term), esc_html($text));
}
echo '</dl>';
if ($diviAvailable) {
echo '<p class="description">' . esc_html__(
'Das Divi-Code-Modul ist immer erlaubt (nur nachrangig) und hat keine eigene Einstellung.',
'wp-lit-mcp'
) . '</p>';
}
}
/** Only when the direct tools get many: then the count is worth a warning, otherwise it is noise. */
private function renderCounter(int $direct): void
{
$warn = $direct > self::DIRECT_WARNING_THRESHOLD;
if ($direct <= self::DIRECT_WARNING_THRESHOLD) {
return;
}
$counter = sprintf(
/* translators: %d: number of direct tools */
_n('Direkt sichtbar: %d Tool', 'Direkt sichtbar: %d Tools', $direct, 'wp-lit-mcp'),
$direct
);
printf(
'<div class="notice notice-%s inline"><p><strong>%s</strong>',
$warn ? 'warning' : 'info',
esc_html($counter)
);
if ($warn) {
echo ' – '
. esc_html__('Viele direkte Tools kosten in claude.ai in jeder Unterhaltung Kontext.', 'wp-lit-mcp')
. ' '
. esc_html__('Selten gebrauchte Tools besser auf „indirekt“ stellen.', 'wp-lit-mcp');
}
printf('<div class="notice notice-warning inline"><p><strong>%s</strong>', esc_html($counter));
echo ' – '
. esc_html__('Viele direkte Tools kosten in claude.ai in jeder Unterhaltung Kontext.', 'wp-lit-mcp')
. ' '
. esc_html__('Selten gebrauchte Tools besser auf „indirekt“ stellen.', 'wp-lit-mcp');
echo '</p></div>';
}