AdminBar.php
2 days ago
AdminBarEditColumns.php
2 days ago
Colors.php
2 days ago
CommonAssets.php
2 days ago
CurrentTable.php
2 days ago
ManageHeadings.php
2 days ago
ManageValue.php
2 days ago
NoticeChecks.php
2 days ago
PluginUpdate.php
2 days ago
PromoChecks.php
2 days ago
QuickEdit.php
2 days ago
SaveHeadings.php
2 days ago
Setup.php
2 days ago
TableRows.php
2 days ago
Tooltips.php
2 days ago
View.php
2 days ago
TableRows.php
36 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Service; |
| 6 | |
| 7 | use AC\Registerable; |
| 8 | use AC\Request; |
| 9 | use AC\TableScreen; |
| 10 | use AC\TableScreen\TableRowsFactory\Aggregate; |
| 11 | |
| 12 | class TableRows implements Registerable |
| 13 | { |
| 14 | private Aggregate $factory; |
| 15 | |
| 16 | public function __construct(Aggregate $factory) |
| 17 | { |
| 18 | $this->factory = $factory; |
| 19 | } |
| 20 | |
| 21 | public function register(): void |
| 22 | { |
| 23 | add_action('ac/table/screen', [$this, 'handle']); |
| 24 | } |
| 25 | |
| 26 | public function handle(TableScreen $table_screen): void |
| 27 | { |
| 28 | $table_rows = $this->factory->create($table_screen); |
| 29 | |
| 30 | if ($table_rows && $table_rows->is_request(new Request())) { |
| 31 | $table_rows->register(); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | } |
| 36 |