Skip to content
Back button control for Nette Framework
PHP HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
LICENSE
README.md
composer.json
phpstan.neon

README.md

Back Button

Build Status Licence Latest stable PHPStan

Installation

The recommended way to is via Composer:

composer require surda/back-button

After that you have to register extension in config.neon:

extensions:
    backButton: Surda\BackButton\BackButtonExtension

Configuration

Default

backButton:
    defaultPresenterLink: 'default'
    templates:
        default: bootstrap4.default.latte
        secondary: bootstrap4.secondary.latte

List of all configuration options:

backButton:
    defaultPresenterLink: 'default'
    useAjax: false
    template: path/to/your/latte/file.latte
    # or
    templates:
        default: path/to/your/latte/file.latte
        foo: path/to/your/latte/foo.latte
        ...

Usage

Presenter

use Nette\Application\UI\Presenter;
use Surda\BackButton\TBackButton;

abstract class ProductPresenter extends Presenter
{
    use TBackButton;
}

Template

Source page (e.g. Product:default) add link to default.latte

<a n:href="detail $id, destination => $currentLink">Detail</a>

Destination page (Product:detail) add component to detail.latte

{control backButton}

Select control template file

Default template

{control backButton} or {control backButton default}  

Set control template by type of template (see config.neon)

{control backButton templateType}

Reset

Reset persistent parameter $destination in URL ...?destination=%2Fproduct

<a n:href="default, destination => NULL">Products</a>

or all (defined) persistent parameters

<a n:href="default, (expand) $resetPersistentParameters">Products</a>
You can’t perform that action at this time.