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

restructured SimpleCmsBundle docs #271

Merged
merged 2 commits into from
Sep 28, 2013
Merged
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
2 changes: 1 addition & 1 deletion bundles/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Bundles
routing_auto
routing/index
search
simple_cms
simple_cms/index
doctrine_phpcr_admin
tree_browser

Expand Down
7 changes: 5 additions & 2 deletions bundles/map.rst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@

* :doc:`search`

* **SimpleCmsbundle**
* :doc:`simple_cms/index`

* :doc:`simple_cms`
* :doc:`simple_cms/introduction`
* :doc:`simple_cms/multilang`
* :doc:`simple_cms/rendering`
* :doc:`simple_cms/extending_page_class`

* **SonataDoctrinePhpcrAdminBundle**

Expand Down
2 changes: 1 addition & 1 deletion bundles/routing_auto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RoutingAutoBundle
The RoutingAutoBundle allows you to define automatically created routes for
documents. This implies a separation of the ``Route`` and ``Content``
documents. If your needs are simple this bundle may not be for you and you
should have a look at :doc:`SimpleCmsBundle <simple_cms>`.
should have a look at :doc:`SimpleCmsBundle <simple_cms/introduction>`.

For the sake of example, we will imagine a blog application that has two
routeable contents, the blog itself, and the posts for the blog. We will call
Expand Down
230 changes: 0 additions & 230 deletions bundles/simple_cms.rst

This file was deleted.

80 changes: 80 additions & 0 deletions bundles/simple_cms/extending_page_class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
.. index::
single: Extending Page; SimpleCmsBundle

Extending the Page class
------------------------

The default Page document (``Symfony\Cmf\Bundle\SimpleCmsBundle\Model\Page``)
is relatively simple, shipping with a handful of the most common properties
for building a typical page: title, body, tags, publish dates etc.

If this is not enough for your project you can easily provide your own
document by extending the default ``Page`` document and explicitly setting the
configuration parameter to your own document class:

.. configuration-block::

.. code-block:: yaml

cmf_simple_cms:
persistence:
phpcr:
document_class: Acme\DemoBundle\Document\MySuperPage

.. code-block:: xml

<?xml version="1.0" charset="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services">

<config xmlns="http://cmf.symfony.com/schema/dic/simplecms">
<persistence>
<phpcr
document-class="Acme\DemoBundle\Document\MySuperPage"
/>
</persistence>
</config>

</container>

.. code-block:: php

$container->loadFromExtension('cmf_simple_cms', array(
'persistence' => array(
'phpcr' => array(
'document_class' => 'Acme\DemoBundle\Document\MySuperPage',
),
),
));

Alternatively, the default ``Page`` document contains an ``extras`` property.
This is a key - value store (where value must be string or ``null``) which can be
used for small trivial additions, without having to extend the default Page
document.

For example::

use Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page;
// ...

$page = new Page();

$page->setTitle('Hello World!');
$page->setBody('Really interesting stuff...');
$page->setLabel('Hello World');

// set extras
$extras = array(
'subtext' => 'Add CMS functionality to applications built with the Symfony2 PHP framework.',
'headline-icon' => 'exclamation.png',
);

$page->setExtras($extras);

$documentManager->persist($page);

These properties can then be accessed in your controller or templates via the
``getExtras()`` or ``getExtra($key)`` methods.

.. _`SimpleCmsBundle`: https://github.com/symfony-cmf/SimpleCmsBundle#readme
.. _`Symfony CMF Standard Edition`: https://github.com/symfony-cmf/symfony-cmf-standard
.. _`CMF website`: https://github.com/symfony-cmf/cmf-website/
10 changes: 10 additions & 0 deletions bundles/simple_cms/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SimpleCmsBundle
===============

.. toctree::
:maxdepth: 2

introduction
multilang
rendering
extending_page_class
Loading