@@ -25,12 +25,12 @@ Concepts
25
25
--------
26
26
27
27
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:
32
32
33
- .. code-block :: html
33
+ .. code-block :: xml
34
34
35
35
<div about =" /cms/content/home" typeof =" schema:WebPage" xmlns : schema =" http://schema.org/" >
36
36
<h1 property =" schema:headline" >The Title</h1 >
@@ -41,8 +41,8 @@ editable. An article might look like this:
41
41
</div >
42
42
43
43
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.
46
46
47
47
Create.js uses backbone.js to save edited data to the server in the JSON-LD
48
48
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
64
64
a REST controller for the backbone.js ajax calls. It also provides helpers to
65
65
bootstrap create.js in your templates.
66
66
67
- .. index :: CreateBundle
68
-
69
67
Dependencies
70
68
------------
71
69
@@ -74,8 +72,8 @@ create.js dependencies like jquery, vie, hallo, backbone and so on. Do not
74
72
forget to add the composer script handler to your ``composer.json `` as described
75
73
below to have CreateBundle clone that repository for you.
76
74
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
79
77
which in turn needs the JmsSerializerBundle. Make sure you load all those
80
78
bundles in your kernel and properly configure Assetic as described below.
81
79
@@ -112,7 +110,7 @@ have the CreateBundle download the necessary libraries:
112
110
It is possible to specify another target directory, repository URL or commit
113
111
id in the extra parameters of ``composer.json `` file if you need to use a
114
112
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
116
114
overwrite them) are:
117
115
118
116
.. code-block :: javascript
@@ -133,16 +131,24 @@ Add this bundle (and its dependencies, if they are not already added) to your
133
131
application's kernel::
134
132
135
133
// app/AppKernel.php
136
- public function registerBundles()
134
+
135
+ // ...
136
+ class AppKernel extends Kernel
137
137
{
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
+
144
148
// ...
145
- );
149
+ }
150
+
151
+ // ...
146
152
}
147
153
148
154
You also need to configure the FOSRestBundle to handle json:
@@ -151,21 +157,28 @@ You also need to configure the FOSRestBundle to handle json:
151
157
152
158
.. code-block :: yaml
153
159
160
+ # app/config/config.yml
154
161
fos_rest :
155
162
view :
156
163
formats :
157
164
json : true
158
165
159
166
.. code-block :: xml
160
167
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 >
166
178
167
179
.. code-block :: php
168
180
181
+ // app/config/config.php
169
182
$container->loadFromExtension('fos_rest', array(
170
183
'view' => array(
171
184
'formats' => array(
@@ -176,7 +189,7 @@ You also need to configure the FOSRestBundle to handle json:
176
189
177
190
If you want to use Assetic to combine the CSS and Javascript used for
178
191
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
180
193
automatically scans all bundles for assets and you don't need to do anything.
181
194
If you limit the bundles, you need to add ``CmfCreateBundle `` to the list of
182
195
bundles.
@@ -186,23 +199,25 @@ bundles.
186
199
.. code-block :: yaml
187
200
188
201
assetic :
189
- bundles : [ ... , CmfCreateBundle, ... ]
202
+ bundles : [... , CmfCreateBundle]
190
203
191
204
.. code-block :: xml
192
205
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 >
198
214
199
215
.. code-block :: php
200
216
201
217
$container->loadFromExtension('assetic', array(
202
218
'bundles' => array(
203
- ...
219
+ // ...
204
220
'CmfCreateBundle',
205
- ...
206
221
),
207
222
));
208
223
@@ -221,7 +236,11 @@ routing configuration to enable the REST end point for saving content:
221
236
222
237
.. code-block :: xml
223
238
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 >
225
244
226
245
.. code-block :: php
227
246
@@ -442,22 +461,20 @@ rendering this field (see below). The default tag is ``div``. And you can
442
461
specify additional HTML attributes like the ``class `` attribute. A full example
443
462
reads like this:
444
463
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 >
461
478
462
479
.. note ::
463
480
0 commit comments