Created
July 28, 2011 07:29
-
-
Save henrikbjorn/1111154 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Diveshare\DiveshareBundle\Templating; | |
/** | |
* Additional helpful methods that is needed in templates. | |
* | |
* @package DiveshareBundle | |
*/ | |
class GlobalVariables extends \Symfony\Bundle\FrameworkBundle\Templating\GlobalVariables | |
{ | |
/** | |
* For use in a twig template with `{% extends app.pjax ? 'empty.twig' : 'base.twig' %}` so it is possible to serve up a chromeless | |
* rendering. | |
* | |
* @return Boolean | |
*/ | |
public function isPjax() | |
{ | |
if ($request = $this->getRequest() && $request->server->has('X-PJAX')) { | |
return true; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
better than replacing the global variable set by the framework (as you cannot do it several times): register a new one