getCustomDirTree() public method

Get a custom directory tree
public getCustomDirTree ( array $cabins, integer $selected, integer $skip ) : array
$cabins array
$selected integer
$skip integer
return array
Exemplo n.º 1
0
 /**
  * We're going to create a directory
  *
  * @route pages/{string}/renamePage
  * @param string $cabin
  */
 public function renamePage(string $cabin)
 {
     $page = [];
     $path = $this->determinePath($cabin);
     if (!\is1DArray($_GET)) {
         \Airship\redirect($this->airship_cabin_prefix . '/pages/' . \trim($cabin, '/'));
     }
     $cabins = $this->getCabinNamespaces();
     if (!\in_array($cabin, $cabins)) {
         \Airship\redirect($this->airship_cabin_prefix);
     }
     $this->setTemplateExtraData($cabin);
     // If you can't publish, you can't make a permanent change like this.
     if (!$this->can('publish')) {
         \Airship\redirect($this->airship_cabin_prefix);
     }
     try {
         $page = $this->pg->getPageInfo($cabin, $path, (string) ($_GET['page'] ?? ''));
     } catch (CustomPageNotFoundException $ex) {
         $this->log('Page not found', LogLevel::NOTICE, ['exception' => \Airship\throwableToArray($ex)]);
         \Airship\redirect($this->airship_cabin_prefix . '/pages/' . \trim($cabin, '/'));
     }
     $post = $this->post(new RenameFilter());
     if (!empty($post)) {
         $this->processMovePage($page, $post, $cabin, $path);
     }
     $this->lens('pages/page_move', ['cabins' => $cabins, 'pageinfo' => $page, 'all_dirs' => $this->pg->getCustomDirTree($cabins, 0), 'dir' => $path, 'cabin' => $cabin, 'pathinfo' => \Airship\chunk($path)]);
 }