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

Commit c4ca128

Browse files
committed
[#344] Some more tweaks
1 parent 27e6d9c commit c4ca128

File tree

1 file changed

+68
-51
lines changed

1 file changed

+68
-51
lines changed

bundles/create/introduction.rst

Lines changed: 68 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ Concepts
2525
--------
2626

2727
To know the RDF model of your data, create.js parses the page DOM for `RDFa`_
28-
attributes. Whenever it encounters an `about` attribute, it knows that this
29-
section is an editable content. The `typeof` attribute tells what type the
30-
content has. The `property` attributes mean that the parts inside that tag are
31-
editable. An article might look like this:
28+
attributes. Whenever it encounters an ``about`` attribute, it knows that this
29+
section is an editable content. The ``typeof`` attribute tells what type the
30+
content has. The ``property`` attributes indicate that the parts inside that tag
31+
are editable. An article might look like this:
3232

33-
.. code-block:: html
33+
.. code-block:: xml
3434
3535
<div about="/cms/content/home" typeof="schema:WebPage" xmlns:schema="http://schema.org/">
3636
<h1 property="schema:headline">The Title</h1>
@@ -41,8 +41,8 @@ editable. An article might look like this:
4141
</div>
4242
4343
Each property has a type. You can configure what editor to use for which type.
44-
CreateBundle comes with two editors: `plaintext` with no formatting, and
45-
WYSIWYG editing. You can also define your own editors.
44+
CreateBundle comes with two editors: **plaintext** (with no formatting) and
45+
**WYSIWYG**. You can also define your own editors.
4646

4747
Create.js uses backbone.js to save edited data to the server in the JSON-LD
4848
format. You may have several objects editable on a single page. There will be
@@ -64,8 +64,6 @@ The CreateBundle finally registers the twig extension in Symfony and provides
6464
a REST controller for the backbone.js ajax calls. It also provides helpers to
6565
bootstrap create.js in your templates.
6666

67-
.. index:: CreateBundle
68-
6967
Dependencies
7068
------------
7169

@@ -74,8 +72,8 @@ create.js dependencies like jquery, vie, hallo, backbone and so on. Do not
7472
forget to add the composer script handler to your ``composer.json`` as described
7573
below to have CreateBundle clone that repository for you.
7674

77-
PHP dependencies are managed through composer. Besides the aforementioned
78-
CreatePHP, CreateBundle also needs the AsseticBundle and the FOSRestBundle
75+
PHP dependencies are managed through composer. Besides the before mentioned
76+
CreatePHP, the CreateBundle also requires the AsseticBundle and the FOSRestBundle
7977
which in turn needs the JmsSerializerBundle. Make sure you load all those
8078
bundles in your kernel and properly configure Assetic as described below.
8179

@@ -112,7 +110,7 @@ have the CreateBundle download the necessary libraries:
112110
It is possible to specify another target directory, repository URL or commit
113111
id in the extra parameters of ``composer.json`` file if you need to use a
114112
development version of CKEditor or create.js. The default values (note that you
115-
should **not hardcode** those in your composer.json unless you need to
113+
should **not hardcode** those in your ``composer.json`` unless you need to
116114
overwrite them) are:
117115

118116
.. code-block:: javascript
@@ -133,16 +131,24 @@ Add this bundle (and its dependencies, if they are not already added) to your
133131
application's kernel::
134132

135133
// app/AppKernel.php
136-
public function registerBundles()
134+
135+
// ...
136+
class AppKernel extends Kernel
137137
{
138-
return array(
139-
// ...
140-
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
141-
new JMS\SerializerBundle\JMSSerializerBundle($this),
142-
new FOS\RestBundle\FOSRestBundle(),
143-
new Symfony\Cmf\Bundle\CreateBundle\CmfCreateBundle(),
138+
public function registerBundles()
139+
{
140+
$bundles = array(
141+
// ...
142+
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
143+
new JMS\SerializerBundle\JMSSerializerBundle($this),
144+
new FOS\RestBundle\FOSRestBundle(),
145+
new Symfony\Cmf\Bundle\CreateBundle\CmfCreateBundle(),
146+
);
147+
144148
// ...
145-
);
149+
}
150+
151+
// ...
146152
}
147153

148154
You also need to configure the FOSRestBundle to handle json:
@@ -151,21 +157,28 @@ You also need to configure the FOSRestBundle to handle json:
151157

152158
.. code-block:: yaml
153159
160+
# app/config/config.yml
154161
fos_rest:
155162
view:
156163
formats:
157164
json: true
158165
159166
.. code-block:: xml
160167
161-
<config xmlns="http://example.org/schema/dic/fos_rest">
162-
<view>
163-
<format name="json">true</format>
164-
</view>
165-
</config>
168+
<!-- app/config/config.xml -->
169+
<?xml version="1.0" encoding="UTF-8" ?>
170+
<container xmlns="http://symfony.com/schema/dic/services">
171+
172+
<config xmlns="http://example.org/schema/dic/fos_rest">
173+
<view>
174+
<format name="json">true</format>
175+
</view>
176+
</config>
177+
</container>
166178
167179
.. code-block:: php
168180
181+
// app/config/config.php
169182
$container->loadFromExtension('fos_rest', array(
170183
'view' => array(
171184
'formats' => array(
@@ -176,7 +189,7 @@ You also need to configure the FOSRestBundle to handle json:
176189
177190
If you want to use Assetic to combine the CSS and Javascript used for
178191
create.js, you need to enable the CreateBundle in the assetic configuration.
179-
Find the configuration for `assetic.bundles`. If it is not present, assetic
192+
Find the configuration for ``assetic.bundles``. If it is not present, assetic
180193
automatically scans all bundles for assets and you don't need to do anything.
181194
If you limit the bundles, you need to add ``CmfCreateBundle`` to the list of
182195
bundles.
@@ -186,23 +199,25 @@ bundles.
186199
.. code-block:: yaml
187200
188201
assetic:
189-
bundles: [ ... , CmfCreateBundle, ...]
202+
bundles: [... , CmfCreateBundle]
190203
191204
.. code-block:: xml
192205
193-
<config xmlns="http://example.org/schema/dic/assetic">
194-
...
195-
<bundle>CmfCreateBundle</bundle>
196-
...
197-
</config>
206+
<?xml version="1.0" encoding="UTF-8" ?>
207+
<container xmlns="http://symfony.com/schema/dic/services">
208+
209+
<config xmlns="http://symfony.com/schema/dic/assetic">
210+
<!-- ... -->
211+
<bundle>CmfCreateBundle</bundle>
212+
</config>
213+
</container>
198214
199215
.. code-block:: php
200216
201217
$container->loadFromExtension('assetic', array(
202218
'bundles' => array(
203-
...
219+
// ...
204220
'CmfCreateBundle',
205-
...
206221
),
207222
));
208223
@@ -221,7 +236,11 @@ routing configuration to enable the REST end point for saving content:
221236
222237
.. code-block:: xml
223238
224-
<import resource="@CmfCreateBundle/Resources/config/routing/rest.xml" />
239+
<?xml version="1.0" encoding="UTF-8" ?>
240+
<routes xmlns="http://symfony.com/schema/dic/routing">
241+
242+
<import resource="@CmfCreateBundle/Resources/config/routing/rest.xml" />
243+
</routes>
225244
226245
.. code-block:: php
227246
@@ -442,22 +461,20 @@ rendering this field (see below). The default tag is ``div``. And you can
442461
specify additional HTML attributes like the ``class`` attribute. A full example
443462
reads like this:
444463

445-
.. configuration-block::
446-
447-
.. code-block:: xml
448-
449-
<!-- Resources/rdf-mappings/Symfony.Cmf.Bundle.ContentBundle.Doctrine.Phpcr.StaticContent.xml -->
450-
<type
451-
xmlns:schema="http://schema.org/"
452-
typeof="schema:WebPage"
453-
>
454-
<children>
455-
<property property="schema:headline" identifier="title" tag-name="h1"/>
456-
<property property="schema:text" identifier="body">
457-
<attribute key="class" value="my-css-class"/>
458-
</property>
459-
</children>
460-
</type>
464+
.. code-block:: xml
465+
466+
<!-- Resources/rdf-mappings/Symfony.Cmf.Bundle.ContentBundle.Doctrine.Phpcr.StaticContent.xml -->
467+
<type
468+
xmlns:schema="http://schema.org/"
469+
typeof="schema:WebPage"
470+
>
471+
<children>
472+
<property property="schema:headline" identifier="title" tag-name="h1"/>
473+
<property property="schema:text" identifier="body">
474+
<attribute key="class" value="my-css-class"/>
475+
</property>
476+
</children>
477+
</type>
461478
462479
.. note::
463480

0 commit comments

Comments
 (0)