|null */ private ?array $screens = null; /** @param list $integrations */ public function __construct(private readonly array $integrations = []) { } /** @return array */ public function all(): array { if ($this->screens === null) { $list = []; foreach (get_post_types(['show_ui' => true], 'objects') as $pt) { if (!in_array($pt->name, ['attachment', 'wp_block'], true)) { $list[] = new PostListScreen($pt); } } $list[] = new MediaListScreen(); $list[] = new UserListScreen(); foreach ($this->integrations as $integration) { $list = $integration->listScreens($list); } /** @var ListScreen[] $list */ $list = apply_filters('lime_columns/list_screens', $list); $this->screens = []; foreach ($list as $s) { $this->screens[$s->key()] = $s; } } return $this->screens; } public function get(string $key): ?ListScreen { return $this->all()[$key] ?? null; } public function forScreen(\WP_Screen $screen): ?ListScreen { foreach ($this->all() as $s) { if ($s->matches($screen)) { return $s; } } return null; } }