HiddenIntegrations final readonly class
Minn\Admin\HiddenIntegrations · public/minn/src/Minn/Admin/HiddenIntegrations.php · 94 lines
What a person hid from their own Minn Admin: the app's per-user map (user meta minn_admin_hidden_integrations, "kind:id" => hidden-at) read and written in the app's own shape so a choice made under WordPress survives the swap and vice versa. The engine registers the core views as hideable; plugin surfaces, editor panels, design sources, and slash namespaces have no registry here, so hiding one is refused as unregistered and a stored hide of one is simply not listed.
Constants and properties
| const | META = 'minn_admin_hidden_integrations' | |
| const | CORE = array ( 'content' => array ( 0 => 'Content', 1 => 'edit_posts', ), 'media' => array ( 0 => 'Media', 1 => 'upload_files', ), 'comments' => array ( 0 => 'Comments', 1 => 'moderate_comments', ), 'orders' => array ( 0 => 'Orders', 1 => 'edit_shop_orders', ), 'subscriptions' => array ( 0 => 'Subscriptions', 1 => 'edit_shop_orders', ), 'products' => array ( 0 => 'Products', 1 => 'edit_products', ), 'coupons' => array ( 0 => 'Coupons', 1 => 'edit_shop_coupons', ), 'customers' => array ( 0 => 'Customers', 1 => 'list_users', ), 'users' => array ( 0 => 'Users', 1 => 'list_users', ), 'terms' => array ( 0 => 'Terms', 1 => 'manage_categories', ), 'menus' => array ( 0 => 'Menus', 1 => 'edit_theme_options', ), 'widgets' => array ( 0 => 'Widgets', 1 => 'edit_theme_options', ), 'posttypes' => array ( 0 => 'Structure', 1 => 'manage_options', ), 'extensions' => array ( 0 => 'Extensions', 1 => 'activate_plugins', ), 'database' => array ( 0 => 'Database', 1 => 'manage_options', ), 'system' => array ( 0 => 'System', 1 => 'manage_options', ), 'settings' => array ( 0 => 'Settings', 1 => 'manage_options', ), ) | Core view id => [label, the capability that shows the view]. |
| private | CAP = 100 | Newest hides kept when the map is capped. |
| private | readonly Minn\Content\Users $users | Promoted from the constructor. |
| private | readonly Minn\Auth\Capabilities $capabilities | Promoted from the constructor. |
Public
| new | __construct(Minn\Content\Users $users, Minn\Auth\Capabilities $capabilities)# | |
| static | sanitize(string $id): string# | The id as the app sends it: lower-case, only word characters, colon, and dash. |
| method | map(int $userId): array# | The views a user has hidden, by id. @return array<string, int> id => hidden-at |
| method | listFor(int $userId): array# | The restore list: every hidden core view the person can still see. @return list<array{id: string, kind: string, label: string, sub: string}> @return list<array{id: string, kind: string, label: string, sub: string}> |
| method | hide(int $userId, string $id): bool# | False when the id names nothing this person could hide. |
| method | unhide(int $userId, string $id): void# | Shows a hidden view again. |
Nothing matches.