Skip to content

Commit

Permalink
#2 code clean up; descriptions added
Browse files Browse the repository at this point in the history
  • Loading branch information
1stthomas committed May 27, 2021
1 parent 28a55e1 commit ff6dc1e
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions controllers/single_page/abstract_redirect_to_first_child.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,26 @@
use \Concrete\Core\Permission\Checker as Permissons;
use \Concrete\Core\Support\Facade\Url;

//use \Concrete\Core\User\User;

abstract class AbstractRedirectToFirstChild extends DashboardPageController
{

public function view()
{
return $this->redirectToFirstChild();
}

/**
* Redirect to the first child of the current page.
*
* This method will redirect to 404 if no children can be found. In case of
* present children, the first child with access permissions will be choosen
* for the redirection. If the current user has no permission to any child
* the response will be 403.
*
* @return \Concrete\Core\Http\Response
*/
protected function redirectToFirstChild()
{
// $u = $this->app->make(User::class);
$responseFactory = $this->app->make(ResponseFactory::class);
$children = $this->c->getCollectionChildren();

Expand All @@ -33,10 +45,4 @@ protected function redirectToFirstChild()
}
}

public function view()
{
// echo "<h1>hier...</h1>";
return $this->redirectToFirstChild();
}

}

0 comments on commit ff6dc1e

Please sign in to comment.