[TwigBundle] replaced the asset tag with an asset function (from {% asset css/foo.css %} to {{ asset('css/foo.css') }}
This commit is contained in:
parent
49a3e52fa8
commit
62cd09e708
@ -8,7 +8,7 @@
|
||||
{% block menu %}
|
||||
<div class="count">{{ '%0.0f'|format(collector.time * 1000) }} ms</div>
|
||||
<div class="count">{{ collector.querycount }}</div>
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Database" src="{% asset 'bundles/webprofiler/images/db.png' %}" />
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Database" src="{{ asset('bundles/webprofiler/images/db.png') }}" />
|
||||
Doctrine
|
||||
{% endblock %}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
{% block menu %}
|
||||
<div class="count">{{ collector.querycount }}</div>
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Mongo" src="{% asset 'bundles/webprofiler/images/db.png' %}" />
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Mongo" src="{{ asset('bundles/webprofiler/images/db.png') }}" />
|
||||
Doctrine MongoDB
|
||||
{% endblock %}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
body { font: 11px Verdana, Arial, sans-serif; color: #333 }
|
||||
.sf-exceptionreset, .sf-exceptionreset .block, .sf-exceptionreset #message { margin: auto }
|
||||
</style>
|
||||
<link href="{% asset 'bundles/framework/css/exception.css' %}" rel="stylesheet" type="text/css" media="screen" />
|
||||
<link href="{{ asset('bundles/framework/css/exception.css') }}" rel="stylesheet" type="text/css" media="screen" />
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function toggle(id, clazz) {
|
||||
|
@ -67,8 +67,9 @@ class TemplatingExtension extends \Twig_Extension
|
||||
public function getFunctions()
|
||||
{
|
||||
return array(
|
||||
'url' => new \Twig_Function_Method($this, 'getUrl'),
|
||||
'path' => new \Twig_Function_Method($this, 'getPath'),
|
||||
'url' => new \Twig_Function_Method($this, 'getUrl'),
|
||||
'path' => new \Twig_Function_Method($this, 'getPath'),
|
||||
'asset' => new \Twig_Function_Method($this, 'getAssetUrl'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -82,6 +83,11 @@ class TemplatingExtension extends \Twig_Extension
|
||||
return $this->container->get('router')->generate($name, $parameters, true);
|
||||
}
|
||||
|
||||
public function getAssetUrl($location)
|
||||
{
|
||||
return $this->container->get('templating.helper.assets')->getUrl($location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the token parser instance to add to the existing list.
|
||||
*
|
||||
@ -102,9 +108,6 @@ class TemplatingExtension extends \Twig_Extension
|
||||
// {% stylesheets %}
|
||||
new HelperTokenParser('stylesheets', '', 'templating.helper.stylesheets', 'render'),
|
||||
|
||||
// {% asset 'css/blog.css' %}
|
||||
new HelperTokenParser('asset', '<location>', 'templating.helper.assets', 'getUrl'),
|
||||
|
||||
// {% render 'BlogBundle:Post:list' with { 'limit': 2 }, { 'alt': 'BlogBundle:Post:error' } %}
|
||||
new HelperTokenParser('render', '<template> [with <attributes:hash>[, <options:hash>]]', 'templating.helper.actions', 'render'),
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{% extends 'WebProfilerBundle:Profiler:layout.twig' %}
|
||||
|
||||
{% block menu %}
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Events" src="{% asset 'bundles/webprofiler/images/events.png' %}" />
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Events" src="{{ asset('bundles/webprofiler/images/events.png') }}" />
|
||||
Events
|
||||
{% endblock %}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
{% extends 'WebProfilerBundle:Profiler:layout.twig' %}
|
||||
|
||||
{% block head %}
|
||||
<link href="{% asset 'bundles/framework/css/exception.css' %}" rel="stylesheet" type="text/css" media="screen" />
|
||||
<link href="{{ asset('bundles/framework/css/exception.css') }}" rel="stylesheet" type="text/css" media="screen" />
|
||||
{% endblock %}
|
||||
|
||||
{% block menu %}
|
||||
{% if collector.hasexception %}
|
||||
<span class="count">1</span>
|
||||
{% endif %}
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Exception" src="{% asset 'bundles/webprofiler/images/exception.png' %}" />
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Exception" src="{{ asset('bundles/webprofiler/images/exception.png') }}" />
|
||||
Exception
|
||||
{% endblock %}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
{% block menu %}
|
||||
<span class="count">{{ collector.counterrors }}</span>
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Logs" src="{% asset 'bundles/webprofiler/images/logger.png' %}" />
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Logs" src="{{ asset('bundles/webprofiler/images/logger.png') }}" />
|
||||
Logs
|
||||
{% endblock %}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block menu %}
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Request" src="{% asset 'bundles/webprofiler/images/request.png' %}" />
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Request" src="{{ asset('bundles/webprofiler/images/request.png') }}" />
|
||||
Request
|
||||
{% endblock %}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block menu %}
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Security" src="{% asset 'bundles/webprofiler/images/security.png' %}" />
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; width: 32px" width="32" height="32" alt="Security" src="{{ asset('bundles/webprofiler/images/security.png') }}" />
|
||||
Security
|
||||
{% endblock %}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="import clearfix">
|
||||
<h3>
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; height: 16px" width="16" height="16" alt="Import" src="{% asset 'bundles/webprofiler/images/import.png' %}" />
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; height: 16px" width="16" height="16" alt="Import" src="{{ asset('bundles/webprofiler/images/import.png') }}" />
|
||||
Admin
|
||||
</h3>
|
||||
|
||||
|
@ -3,9 +3,9 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>{% block title 'Profiler' %}</title>
|
||||
<link href="{% asset 'bundles/webprofiler/css/profiler.css' %}" rel="stylesheet" type="text/css" media="screen" />
|
||||
<link href="{% asset 'bundles/webprofiler/css/toolbar.css' %}" rel="stylesheet" type="text/css" media="screen" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{% asset 'bundles/webprofiler/favicon.ico' %}" />
|
||||
<link href="{{ asset('bundles/webprofiler/css/profiler.css') }}" rel="stylesheet" type="text/css" media="screen" />
|
||||
<link href="{{ asset('bundles/webprofiler/css/toolbar.css') }}" rel="stylesheet" type="text/css" media="screen" />
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{{ asset('bundles/webprofiler/favicon.ico') }}" />
|
||||
{% block head '' %}
|
||||
</head>
|
||||
<body>
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block body %}
|
||||
<div class="header">
|
||||
<h1>
|
||||
<img alt="" src="{% asset 'bundles/webprofiler/images/profiler.png' %}" />
|
||||
<img alt="" src="{{ asset('bundles/webprofiler/images/profiler.png') }}" />
|
||||
Symfony Profiler
|
||||
</h1>
|
||||
<div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
{% block body %}
|
||||
<div class="header">
|
||||
<h1>
|
||||
<img alt="" src="{% asset 'bundles/webprofiler/images/profiler.png' %}" />
|
||||
<img alt="" src="{{ asset('bundles/webprofiler/images/profiler.png') }}" />
|
||||
Symfony Profiler
|
||||
</h1>
|
||||
<div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="search clearfix">
|
||||
<h3>
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; height: 16px" width="16" height="16" alt="Search" src="{% asset 'bundles/webprofiler/images/search.png' %}" />
|
||||
<img style="margin: 0 5px 0 0; vertical-align: middle; height: 16px" width="16" height="16" alt="Search" src="{{ asset('bundles/webprofiler/images/search.png') }}" />
|
||||
Search
|
||||
</h3>
|
||||
<form action="{{ path('_profiler_search') }}" method="get">
|
||||
|
Reference in New Issue
Block a user