Airship\Cabin\Bridge\Landing\PageManager::forCabin PHP Method

forCabin() public method

List all of the subdirectories and custom pages in a given directory
public forCabin ( string $cabin = '' )
$cabin string
    public function forCabin(string $cabin = '')
    {
        $path = $this->determinePath($cabin);
        $cabins = $this->getCabinNamespaces();
        if (!\in_array($cabin, $cabins)) {
            \Airship\redirect($this->airship_cabin_prefix);
        }
        $this->pg->setCabin($cabin);
        // Let's populate the subdirectories for the current directory
        try {
            $dirs = $this->pg->listSubDirectories($path, $cabin);
        } catch (CustomPageNotFoundException $ex) {
            if (!empty($path)) {
                \Airship\redirect($this->airship_cabin_prefix . '/pages/' . \trim($cabin, '/'));
            }
            $dirs = [];
        }
        // Let's populate the subdirectories for the current directory
        try {
            $pages = $this->pg->listCustomPages($path, $cabin);
        } catch (CustomPageNotFoundException $ex) {
            $pages = [];
        }
        $this->setTemplateExtraData($cabin);
        $this->lens('pages_list', ['cabins' => $cabins, 'dirs' => $dirs, 'pages' => $pages, 'current' => $path, 'cabin' => $cabin, 'path' => \Airship\chunk($path)]);
    }