feat: Protokoll tab as a core-style list table
The change summary is the wide primary column (key "title", so it cannot
be hidden) with the tool's human label below and row actions "Revision
ansehen" / "Objekt öffnen". Objects get human names ("Seite: Kontakt",
"Menü: …", "Einstellungen: Titel der Website"; deleted/trashed marked),
primed per page with one query each for posts, menus and users. Times are
relative within 24 h. Non-ok results show a badge and a marked row instead
of an Ergebnis column. Page size and columns via Screen Options; the tool
filter shows labels grouped by integration, dates have visible labels,
and an active filter offers "Filter zurücksetzen" (also in the empty state).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -59,16 +59,59 @@ if (! class_exists('WP_List_Table')) {
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
/** Like the real class: the per-page screen option of the current user, else the default. */
|
||||
protected function get_items_per_page($option, $default_value = 20): int
|
||||
{
|
||||
$perPage = (int) get_user_option($option);
|
||||
|
||||
return $perPage < 1 ? $default_value : $perPage;
|
||||
}
|
||||
|
||||
protected function get_default_primary_column_name()
|
||||
{
|
||||
$columns = $this->get_columns();
|
||||
|
||||
return (string) array_key_first($columns);
|
||||
}
|
||||
|
||||
/** @param array<string, mixed> $item */
|
||||
protected function single_row_columns($item): void
|
||||
{
|
||||
$primary = $this->get_default_primary_column_name();
|
||||
foreach (array_keys($this->get_columns()) as $column_name) {
|
||||
$method = 'column_' . $column_name;
|
||||
$value = method_exists($this, $method) ? $this->{$method}($item) : $this->column_default($item, $column_name);
|
||||
$value .= $this->handle_row_actions($item, $column_name, $primary);
|
||||
printf('<td class="%s">%s</td>', $column_name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
/** Like the real class: only the mobile toggle in the primary column. */
|
||||
protected function handle_row_actions($item, $column_name, $primary)
|
||||
{
|
||||
return $column_name === $primary ? $this->toggleRow() : '';
|
||||
}
|
||||
|
||||
/** @param array<string, string> $actions */
|
||||
protected function row_actions($actions, $always_visible = false)
|
||||
{
|
||||
if ($actions === []) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$links = [];
|
||||
foreach ($actions as $action => $link) {
|
||||
$links[] = "<span class='{$action}'>{$link}</span>";
|
||||
}
|
||||
|
||||
return '<div class="row-actions">' . implode(' | ', $links) . '</div>' . $this->toggleRow();
|
||||
}
|
||||
|
||||
private function toggleRow(): string
|
||||
{
|
||||
return '<button type="button" class="toggle-row"><span class="screen-reader-text">Show more details</span></button>';
|
||||
}
|
||||
|
||||
/** @param array<string, mixed> $item */
|
||||
protected function column_default($item, $column_name): string
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user