Skip to content

Commit

Permalink
add filter and event
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanashi committed Nov 17, 2024
1 parent b3a7f24 commit 5e66b67
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace wcf\system\event\gridView;

use wcf\event\IPsr14Event;
use wcf\system\gridView\DiscordBotListGridView;

final class DiscordBotListGridViewInitialized implements IPsr14Event
{
public function __construct(public readonly DiscordBotListGridView $gridView)
{
}
}
19 changes: 16 additions & 3 deletions files/lib/system/gridView/DiscordBotListGridView.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
use wcf\data\DatabaseObjectList;
use wcf\data\discord\bot\DiscordBot;
use wcf\data\discord\bot\DiscordBotList;
use wcf\event\IPsr14Event;
use wcf\system\event\gridView\DiscordBotListGridViewInitialized;
use wcf\system\gridView\action\DeleteAction;
use wcf\system\gridView\action\EditAction;
use wcf\system\gridView\filter\TextFilter;
use wcf\system\gridView\filter\TimeFilter;
use wcf\system\gridView\renderer\DefaultColumnRenderer;
use wcf\system\gridView\renderer\NumberColumnRenderer;
use wcf\system\gridView\renderer\TimeColumnRenderer;
Expand All @@ -27,7 +31,8 @@ public function __construct()
GridViewColumn::for('botName')
->label('wcf.acp.discordBotList.botName')
->renderer(new TitleColumnRenderer())
->sortable(),
->sortable()
->filter(new TextFilter()),
GridViewColumn::for('guildName')
->label('wcf.acp.discordBotList.server')
->renderer([
Expand All @@ -52,11 +57,13 @@ public function render(mixed $value, mixed $context = null): string
}
},
])
->sortable(),
->sortable()
->filter(new TextFilter()),
GridViewColumn::for('botTime')
->label('wcf.global.date')
->renderer(new TimeColumnRenderer())
->sortable(),
->sortable()
->filter(new TimeFilter()),
]);

$this->addActions([
Expand All @@ -78,4 +85,10 @@ protected function createObjectList(): DatabaseObjectList
{
return new DiscordBotList();
}

#[Override]
protected function getInitializedEvent(): ?IPsr14Event

Check failure on line 90 in files/lib/system/gridView/DiscordBotListGridView.class.php

View workflow job for this annotation

GitHub Actions / PHP

Line indented incorrectly; expected 4 spaces, found 5

Check failure on line 90 in files/lib/system/gridView/DiscordBotListGridView.class.php

View workflow job for this annotation

GitHub Actions / PHP

Line indented incorrectly; expected 4 spaces, found 5
{
return new DiscordBotListGridViewInitialized($this);
}

Check failure on line 93 in files/lib/system/gridView/DiscordBotListGridView.class.php

View workflow job for this annotation

GitHub Actions / PHP

Line indented incorrectly; expected 4 spaces, found 5

Check failure on line 93 in files/lib/system/gridView/DiscordBotListGridView.class.php

View workflow job for this annotation

GitHub Actions / PHP

Line indented incorrectly; expected 4 spaces, found 5
}

0 comments on commit 5e66b67

Please sign in to comment.