2017 © Pedro Peláez
 

symfony-bundle frontend-url-bundle

Symfony Frontend Url bundle - Provides helpers to easily generate URLs for frontend routes from within an admin environment.

image

genj/frontend-url-bundle

Symfony Frontend Url bundle - Provides helpers to easily generate URLs for frontend routes from within an admin environment.

  • Friday, March 10, 2017
  • by genj
  • Repository
  • 5 Watchers
  • 1 Stars
  • 3,967 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 1 % Grown

The README.md

GenjFrontendUrlBundle

Provides helpers to generate frontend URLs. Your Entities need these methods in order for this bundle to work:, (*1)

    public function getRouteName()
    {
        return 'genj_article_article_show';
    }

    public function getRouteParameters()
    {
        return array(
            'categoryType' => $this->getCategory()->getType(),
            'categorySlug' => $this->getCategory()->getSlug(),
            'slug'         => $this->getSlug()
        );
    }   

Configuration

You must set the name of your frontend environment in config.yml:, (*2)

genj_frontend_url:
    frontend_environment: my_frontend_app

Usage

Front-end URL generation

From twig:, (*3)

{{ object|genj_url_for_frontend }}

From PHP:, (*4)

$urlGenerator = $this->container->get('genj_url_generator.routing.frontend.generator.url_generator');
$frontendUrl  = $urlGenerator->generateFrontendUrlForObject($object);

Preview parameter

It is possible to generate a URL to a 'preview controller'. You could e.g. restrict access to that controller and show non-cached versions of certain pages. If you do:, (*5)

$frontendUrl  = $urlGenerator->generateFrontendUrlForObject($object, true);

Then the resulting URL would become /preview.php/path/to/page., (*6)

You can use the same thing from Twig too:, (*7)

{{ object|genj_url_for_frontend(true) }}

More about environments: http://symfony.com/doc/current/cookbook/configuration/environments.html, (*8)

The Versions

10/03 2017

dev-master

9999999-dev

Symfony Frontend Url bundle - Provides helpers to easily generate URLs for frontend routes from within an admin environment.

  Sources   Download

MIT

The Requires

 

by Choong Wei Tjeng
by Nico Kaag
by Susan Lau

frontend url php bundle generator symfony routing symfony-bundle genj

09/08 2015

v1.0.0

1.0.0.0

Symfony Frontend Url bundle

  Sources   Download

MIT

The Requires

 

by Choong Wei Tjeng
by Nico Kaag
by Susan Lau

frontend url bundle generator symfony routing genj