Skip to content

Commit 0eddc5c

Browse files
committed
rebase
1 parent da6afe8 commit 0eddc5c

File tree

1 file changed

+0
-186
lines changed

1 file changed

+0
-186
lines changed

reference/dic_tags.rst

Lines changed: 0 additions & 186 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@ may also be tags in other bundles you use that aren't listed here.
1515
======================================== ========================================================================
1616
Tag Name Usage
1717
======================================== ========================================================================
18-
`assetic.asset`_ Register an asset to the current asset manager
19-
`assetic.factory_worker`_ Add a factory worker
20-
`assetic.filter`_ Register a filter
21-
`assetic.formula_loader`_ Add a formula loader to the current asset manager
22-
`assetic.formula_resource`_ Adds a resource to the current asset manager
23-
`assetic.templating.php`_ Remove this service if PHP templating is disabled
24-
`assetic.templating.twig`_ Remove this service if Twig templating is disabled
2518
`auto_alias`_ Define aliases based on the value of container parameters
2619
`console.command`_ Add a command
2720
`data_collector`_ Create a class that collects custom data for the profiler
@@ -55,185 +48,6 @@ Tag Name Usage
5548
`validator.initializer`_ Register a service that initializes objects before validation
5649
======================================== ========================================================================
5750

58-
assetic.asset
59-
-------------
60-
61-
**Purpose**: Register an asset with the current asset manager
62-
63-
assetic.factory_worker
64-
----------------------
65-
66-
**Purpose**: Add a factory worker
67-
68-
A Factory worker is a class implementing ``Assetic\Factory\Worker\WorkerInterface``.
69-
Its ``process($asset)`` method is called for each asset after asset creation.
70-
You can modify an asset or even return a new one.
71-
72-
In order to add a new worker, first create a class::
73-
74-
use Assetic\Asset\AssetInterface;
75-
use Assetic\Factory\Worker\WorkerInterface;
76-
77-
class MyWorker implements WorkerInterface
78-
{
79-
public function process(AssetInterface $asset)
80-
{
81-
// ... change $asset or return a new one
82-
}
83-
84-
}
85-
86-
And then register it as a tagged service:
87-
88-
.. configuration-block::
89-
90-
.. code-block:: yaml
91-
92-
services:
93-
app.custom_assetic_worker:
94-
class: AppBundle\Assetic\CustomWorker
95-
tags:
96-
- { name: assetic.factory_worker }
97-
98-
.. code-block:: xml
99-
100-
<?xml version="1.0" encoding="UTF-8" ?>
101-
<container xmlns="http://symfony.com/schema/dic/services"
102-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
103-
xsi:schemaLocation="http://symfony.com/schema/dic/services
104-
http://symfony.com/schema/dic/services/services-1.0.xsd">
105-
106-
<services>
107-
<service id="app.custom_assetic_worker" class="AppBundle\Assetic\CustomWorker">
108-
<tag name="assetic.factory_worker" />
109-
</service>
110-
</services>
111-
</container>
112-
113-
.. code-block:: php
114-
115-
use AppBundle\Assetic\CustomWorker;
116-
117-
$container
118-
->register('app.custom_assetic_worker', CustomWorker::class)
119-
->addTag('assetic.factory_worker')
120-
;
121-
122-
assetic.filter
123-
--------------
124-
125-
**Purpose**: Register a filter
126-
127-
AsseticBundle uses this tag to register common filters. You can also use
128-
this tag to register your own filters.
129-
130-
First, you need to create a filter::
131-
132-
use Assetic\Asset\AssetInterface;
133-
use Assetic\Filter\FilterInterface;
134-
135-
class MyFilter implements FilterInterface
136-
{
137-
public function filterLoad(AssetInterface $asset)
138-
{
139-
$asset->setContent('alert("yo");' . $asset->getContent());
140-
}
141-
142-
public function filterDump(AssetInterface $asset)
143-
{
144-
// ...
145-
}
146-
}
147-
148-
Second, define a service:
149-
150-
.. configuration-block::
151-
152-
.. code-block:: yaml
153-
154-
services:
155-
app.custom_assetic_filter:
156-
class: AppBundle\Assetic\CustomFilter
157-
tags:
158-
- { name: assetic.filter, alias: my_filter }
159-
160-
.. code-block:: xml
161-
162-
<?xml version="1.0" encoding="UTF-8" ?>
163-
<container xmlns="http://symfony.com/schema/dic/services"
164-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
165-
xsi:schemaLocation="http://symfony.com/schema/dic/services
166-
http://symfony.com/schema/dic/services/services-1.0.xsd">
167-
168-
<services>
169-
<service id="app.custom_assetic_filter" class="AppBundle\Assetic\CustomFilter">
170-
<tag name="assetic.filter" alias="my_filter" />
171-
</service>
172-
</services>
173-
</container>
174-
175-
.. code-block:: php
176-
177-
use AppBundle\Assetic\CustomFilter;
178-
179-
$container
180-
->register('app.custom_assetic_filter', CustomFilter::class)
181-
->addTag('assetic.filter', array('alias' => 'my_filter'))
182-
;
183-
184-
Finally, apply the filter:
185-
186-
.. code-block:: twig
187-
188-
{% javascripts
189-
'@AcmeBaseBundle/Resources/public/js/global.js'
190-
filter='my_filter'
191-
%}
192-
<script src="{{ asset_url }}"></script>
193-
{% endjavascripts %}
194-
195-
You can also apply your filter via the ``assetic.filters.my_filter.apply_to``
196-
config option as it's described here: :doc:`/assetic/apply_to_option`.
197-
In order to do that, you must define your filter service in a separate xml
198-
config file and point to this file's path via the ``assetic.filters.my_filter.resource``
199-
configuration key.
200-
201-
assetic.formula_loader
202-
----------------------
203-
204-
**Purpose**: Add a formula loader to the current asset manager
205-
206-
A Formula loader is a class implementing
207-
``Assetic\\Factory\Loader\\FormulaLoaderInterface`` interface. This class
208-
is responsible for loading assets from a particular kind of resources (for
209-
instance, twig template). Assetic ships loaders for PHP and Twig templates.
210-
211-
An ``alias`` attribute defines the name of the loader.
212-
213-
assetic.formula_resource
214-
------------------------
215-
216-
**Purpose**: Adds a resource to the current asset manager
217-
218-
A resource is something formulae can be loaded from. For instance, Twig
219-
templates are resources.
220-
221-
assetic.templating.php
222-
----------------------
223-
224-
**Purpose**: Remove this service if PHP templating is disabled
225-
226-
The tagged service will be removed from the container if the
227-
``framework.templating.engines`` config section does not contain php.
228-
229-
assetic.templating.twig
230-
-----------------------
231-
232-
**Purpose**: Remove this service if Twig templating is disabled
233-
234-
The tagged service will be removed from the container if
235-
``framework.templating.engines`` config section does not contain ``twig``.
236-
23751
auto_alias
23852
----------
23953

0 commit comments

Comments
 (0)