kekos/booya-viewstate

Viewstate for Booya framework

v1.0.0 2016-03-20 19:27 UTC

This package is auto-updated.

Last update: 2024-05-09 20:44:25 UTC


README

Remembers query string-parameters used to render one view when user is going back to first view from another view.

Install

You can install Booya ViewState via Composer:

composer require kekos/booya-viewstate

API

Use the viewstate as trait:

use Booya\LayoutController;
use Booya\ViewState\ControllerTrait as ViewStateTrait;

class IndexController extends LayoutController {
  use ViewStateTrait;

  public function index() {
    $this->viewState();
  }

  public function other_action() {
    $this->viewState();
  }
}

In view index.php:

<a href="index/other_action<?php echo uh($flow_qs); ?>">Go to other view</a>

In view other_action.php:

<a href="index<?php echo uh($origin_qs); ?>">Go back to first view</a>

Redirect back to origin action

$this->redirectToOrigin('index');

Bugs and improvements

Report bugs in GitHub issues or feel free to make a pull request :-)

License

MIT