-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.php
More file actions
35 lines (30 loc) · 953 Bytes
/
example.php
File metadata and controls
35 lines (30 loc) · 953 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* Recipe: Super Simple Data Source.
* See readme.md for the walkthrough.
*/
declare(strict_types=1);
use ACA\DataSources\DataSource;
use ACA\DataSources\DataSourceRegistry;
use ACA\DataSources\DataSourceRegistry\Entry;
use ACA\DataSources\Facade;
use ACA\DataSources\Type\DataSourceId;
add_action('acp/data-sources/register', static function (DataSourceRegistry $registry): void {
$data_source = new DataSource(
new DataSourceId('cookbook_users'),
Facade\Table::from('wp_users')
);
$registry->register(
Entry::create($data_source)
->set_submenu('01. Simple Users', 'ac-ds-cookbook')
);
// Or use this if you want a main menu item
// $registry->register(
// Entry::create($data_source)
// ->set_menu(
// 'Simple Users',
// null,
// 'dashicons-book-alt'
// )
// );
});