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

Commit cb53c10

Browse files
committed
restructured SimpleCmsBundle docs
1 parent 454893b commit cb53c10

File tree

14 files changed

+222
-243
lines changed

14 files changed

+222
-243
lines changed

bundles/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Bundles
1515
routing_auto
1616
routing/index
1717
search
18-
simple_cms
18+
simple_cms/index
1919
doctrine_phpcr_admin
2020
tree_browser
2121

bundles/map.rst.inc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@
5151

5252
* :doc:`search`
5353

54-
* **SimpleCmsbundle**
54+
* :doc:`simple_cms/index`
5555

56-
* :doc:`simple_cms`
56+
* :doc:`simple_cms/introduction`
57+
* :doc:`simple_cms/multilang`
58+
* :doc:`simple_cms/rendering`
59+
* :doc:`simple_cms/extending_page_class`
5760

5861
* **SonataDoctrinePhpcrAdminBundle**
5962

bundles/routing_auto.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RoutingAutoBundle
1212
The RoutingAutoBundle allows you to define automatically created routes for
1313
documents. This implies a separation of the ``Route`` and ``Content``
1414
documents. If your needs are simple this bundle may not be for you and you
15-
should have a look at :doc:`SimpleCmsBundle <simple_cms>`.
15+
should have a look at :doc:`SimpleCmsBundle <simple_cms/introduction>`.
1616

1717
For the sake of example, we will imagine a blog application that has two
1818
routeable contents, the blog itself, and the posts for the blog. We will call

bundles/simple_cms.rst

Lines changed: 0 additions & 230 deletions
This file was deleted.
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
Extending the Page class
2+
------------------------
3+
4+
The default Page document ``Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page``
5+
is relatively simple, shipping with a handful of the most common properties
6+
for building a typical page: title, body, tags, publish dates etc.
7+
8+
If this is not enough for your project you can easily provide your own
9+
document by extending the default Page document and explicitly setting the
10+
configuration parameter to your own document class:
11+
12+
.. configuration-block::
13+
14+
.. code-block:: yaml
15+
16+
cmf_simple_cms:
17+
persistence:
18+
phpcr:
19+
document_class: Acme\DemoBundle\Document\MySuperPage
20+
21+
.. code-block:: xml
22+
23+
<?xml version="1.0" charset="UTF-8" ?>
24+
<container xmlns="http://symfony.com/schema/dic/services">
25+
26+
<config xmlns="http://cmf.symfony.com/schema/dic/simplecms">
27+
<persistence>
28+
<phpcr
29+
document-class="Acme\DemoBundle\Document\MySuperPage"
30+
/>
31+
</persistence>
32+
</config>
33+
34+
</container>
35+
36+
.. code-block:: php
37+
38+
$container->loadFromExtension('cmf_simple_cms', array(
39+
'persistence' => array(
40+
'phpcr' => array(
41+
'document_class' => 'Acme\DemoBundle\Document\MySuperPage',
42+
),
43+
),
44+
));
45+
46+
Alternatively, the default Page document contains an ``extras`` property. This
47+
is a key - value store (where value must be string or null) which can be used
48+
for small trivial additions, without having to extend the default Page
49+
document.
50+
51+
For example::
52+
53+
$page = new Page();
54+
55+
$page->setTitle('Hello World!');
56+
$page->setBody('Really interesting stuff...');
57+
$page->setLabel('Hello World');
58+
59+
// set extras
60+
$extras = array(
61+
'subtext' => 'Add CMS functionality to applications built with the Symfony2 PHP framework.',
62+
'headline-icon' => 'exclamation.png',
63+
);
64+
65+
$page->setExtras($extras);
66+
67+
$documentManager->persist($page);
68+
69+
These properties can then be accessed in your controller or templates via the
70+
``getExtras()`` or ``getExtra($key)`` methods.
71+
72+
.. _`SimpleCmsBundle`: https://github.com/symfony-cmf/SimpleCmsBundle#readme
73+
.. _`Symfony CMF Standard Edition`: https://github.com/symfony-cmf/symfony-cmf-standard
74+
.. _`CMF website`: https://github.com/symfony-cmf/cmf-website/

bundles/simple_cms/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SimpleCmsBundle
2+
===============
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
introduction
8+
multilang
9+
rendering
10+
extending_page_class

bundles/simple_cms/introduction.rst

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
.. index::
2+
single: SimpleCms; Bundles
3+
single: SimpleCmsBundle
4+
5+
SimpleCmsBundle
6+
===============
7+
8+
The SimpleCmsBundle provides a simplistic CMS on top of the CMF components
9+
and bundles.
10+
11+
While the core CMF components focus on flexibility, the simple CMS trades away
12+
some of that flexibility in favor of simplicity.
13+
14+
The SimpleCmsBundle provides a solution to easily map content, routes and menu
15+
items based on a single tree structure in the content repository.
16+
17+
For a simple example installation of the bundle check out the
18+
`Symfony CMF Standard Edition`_
19+
20+
You can find an introduction to the bundle in the
21+
:doc:`Getting started <../../book/simplecms>` section.
22+
23+
The `CMF website`_ is another application using the SimpleCmsBundle.
24+
25+
Installation
26+
------------
27+
28+
You can install the bundle in 2 different ways:
29+
30+
* Use the official Git repository (https://github.com/symfony-cmf/SimpleCmsBundle);
31+
* Install it via Composer (``symfony-cmf/simple-cms-bundle`` on `Packagist`_).
32+
33+
Sections
34+
--------
35+
36+
* :doc:`multilang`
37+
* :doc:`rendering`
38+
* :doc:`extending_page_class`
39+
40+
.. _`Symfony CMF Standard Edition`: https://github.com/symfony-cmf/symfony-cmf-standard
41+
.. _`CMF website`: https://github.com/symfony-cmf/cmf-website/
42+
.. _`Packagist`: https://packagist.org/packages/symfony-cmf/simple-cms-bundle

0 commit comments

Comments
 (0)