The hook, core model, and shortcut facades for getting a Data Source into the admin.
Fires once, after Admin Columns Pro has booted. The only place where Data Sources should be registered.
add_action('acp/data-sources/register', function (DataSourceRegistry $registry) {
// register Data Sources here
});Model of one browsable table. Combines an identifier, a table, optional column configuration, and optional relations.
new DataSource(
DataSourceId $id,
Repository\Database\Table $table,
?Config\Columns $columns = null,
?RelationFactoryCollection $relations = null
)See: Tables, Columns, Relations.
Value object wrapping the unique string identifier of a Data Source. The
identifier must match ^[a-z][a-z0-9]*(_[a-z0-9]+)*$ (lowercase
snake_case starting with a letter).
new DataSourceId('cookbook_users')The registry passed into acp/data-sources/register. Call register()
with an Entry to add a Data Source.
$registry->register(Entry $entry): voidWraps a DataSource with admin-menu metadata before registration.
Entry::create(DataSource $data_source): self
$entry->set_menu(string $title, ?string $menu_title = null, ?string $icon = null, ?int $position = null): self
$entry->set_submenu(string $title, string $parent_slug, ?string $menu_title = null, ?int $position = null): self
$entry->set_group(AC\Type\Group $group): self
$entry->set_capabilities(Capabilities $capabilities): selfset_menu places the Data Source under its own top-level item.
set_submenu places it under an existing admin menu (identified by its
slug).
Facade\* classes are static helpers that wrap the core constructors.
They accept plain strings and handle table resolution for you. Prefer
them when you do not need to customise the object after creation.
Builds a DataSource from a table name in one call.
Facade\DataSource::from(
string $table,
string $data_source_id,
?Config\Columns $config = null,
?RelationFactoryCollection $relations = null
): DataSourceBuilds a DataSourceRegistry\Entry directly from a table name. A
one-call shortcut for simple Data Sources.
Facade\Entry::from(
string $table,
string $data_source_id,
?Config\Columns $config = null,
?RelationFactoryCollection $relations = null
): DataSourceRegistry\Entry