Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

[WIP] Added some docs for core publish workflow and menu reference to it #148

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 59 additions & 1 deletion bundles/core.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,27 @@ Configuration

.. _bundle-core-publish_workflow:

Publish Workflow
----------------

The publish workflow system enables the user to specify if and when classes
implementing the ``PublishWorkFlowInterface`` should be published.

PublishWorkFlowInterface
~~~~~~~~~~~~~~~~~~~~~~~~

Classes implementing the publish workflow interface need to implement the
following methods

* **isPublishable**: If the object should be considered for publication or
not;
* **getPublishStartDate**: If non-null, the date from which the document
should start being published;
* **getPublishEndDate**: If non-null, the date from which the document
should stop being published.

Publish workflow checker
------------------------
~~~~~~~~~~~~~~~~~~~~~~~~

The Bundle provides a ``symfony_cmf_core.publish_workflow_checker`` service which implements
``PublishWorkflowCheckerInterface``. This interface defines a single method ``checkIsPublished()``.
Expand All @@ -41,6 +60,41 @@ The Bundle provides a ``symfony_cmf_core.publish_workflow_checker`` service whic
..
}

Publish Workflow Admin Extension
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The Bundle also provides an admin extension so you can easily add the publish
workflow fields to all or selected administrable classes. Just add the
extension configuration to the ``sonata_admin`` section of your main
configuration:

.. configuration-block::

.. code-block:: yaml

# app/config.yml
sonata_admin:
# ...
extensions:
symfony_cmf_core.admin_extension.publish_workflow:
implements:
- Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishWorkflowInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes the extension automatically active in all admins that admin a class implementing that interface, without the admin needing to know about it? pretty magic! if i got that right, we should put one sentence to make people understand that. i was expecting we need something more explicit to make this happen...


.. code-block:: php

// app/config/config.php
$container->loadFromExtension('sonata_admin', array(
'extensions' => array(
'symfony_cmf_core.admin_extension.publish_workflow' => array(
'implements' => array(
'Symfony\Cmf\Bundle\CoreBundle\PublishWorkflow\PublishWorkflowInterface',
),
),
),
));

See the `Sonata Admin extension documentation`_ for more information.

Dependency Injection Tags
-------------------------

Expand Down Expand Up @@ -120,3 +174,7 @@ Implements the following functions:
<a href="{{ path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')|merge(app.request.query.all)|merge({'_locale': 'fr'})) }}">DE</a>
{% endif %}
{% endif %}

.. _`Sonata Admin extension documentation`: http://sonata-project.org/bundles/admin/master/doc/reference/extensions.html


6 changes: 6 additions & 0 deletions bundles/menu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,9 @@ Note that if you just want to generate normal symfony routes with a menu that
is in the database, you can pass the core router service as content_url_generator,
make sure the content_key never matches and make your menu documents provide
the route name and eventual routeParameters.

Publish Workflow Interface
--------------------------

Menu nodes implement the ``PublishWorkFlowInterface``, see :doc:`publish workflow documentation <core>` for more information.