Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:roadiz/docs into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Apr 14, 2015
2 parents 0809749 + 2290c4e commit b02335b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Extension system
:maxdepth: 2

themes/extending_roadiz
roadiz-events/intro



Expand Down
53 changes: 53 additions & 0 deletions roadiz-events/intro.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.. _events:

Using Roadiz events
===================

Roadiz node system implements several events. So you will be able to create
and inject your own event subscribers inside *Roadiz* dispatcher.

To understand how the event dispatcher works, you should read the
`documentation from Symfony <http://symfony.com/doc/current/components/event_dispatcher/introduction.html>`_ before.


Nodes events
-----------

``RZ\Roadiz\Core\Events\NodeEvents``

* *node.created:* ``NodeEvents::NODE_CREATED``
* *node.updated:* ``NodeEvents::NODE_UPDATED``
* *node.deleted:* ``NodeEvents::NODE_DELETED``
* *node.undeleted:* ``NodeEvents::NODE_UNDELETED``
* *node.tagged:* ``NodeEvents::NODE_TAGGED`` This event is triggered for tag and un-tag action.

Every node events methods will accept a ``RZ\Roadiz\Core\Events\FilterNodeEvent`` object as argument.
This object contains the current ``Node`` entity. You will get it using ``$event->getNode()``.

NodesSources events
-------------------

``RZ\Roadiz\Core\Events\NodesSourcesEvents``

* *nodeSource.created:* ``NodesSourcesEvents::NODE_SOURCE_CREATED``
* *nodeSource.updated:* ``NodesSourcesEvents::NODE_SOURCE_UPDATED``
* *nodeSource.deleted:* ``NodesSourcesEvents::NODE_SOURCE_DELETED``

Every node-source events methods will accept a ``RZ\Roadiz\Core\Events\FilterNodesSourcesEvent`` object as argument.
This object contains the current ``NodesSources`` entity. You will get it using ``$event->getNodeSource()``.

.. note::
You will find a simple subscriber example in Roadiz back-office theme which is called ``Themes\Rozier\Events\SolariumSubscriber``.
This subscriber is useful to update or delete your *Solr* index documents against your node-source database.

Tags events
-----------

``RZ\Roadiz\Core\Events\TagEvents``

* *tag.created:* ``TagEvents::TAG_CREATED``
* *tag.updated:* ``TagEvents::TAG_UPDATED``
* *tag.deleted:* ``TagEvents::TAG_DELETED``

Every tag events methods will accept a ``RZ\Roadiz\Core\Events\FilterTagEvent`` object as argument.
This object contains the current ``Tag`` entity. You will get it using ``$event->getTag()``.

0 comments on commit b02335b

Please sign in to comment.