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

Commit 930db44

Browse files
committed
Revert "removing blockbundle cookbook entry"
This reverts commit e57c5ac.
1 parent e57c5ac commit 930db44

File tree

2 files changed

+702
-71
lines changed

2 files changed

+702
-71
lines changed

bundles/block/introduction.rst

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,6 @@ time a block is rendered before the ``execute`` method is called.
328328
Block rendering
329329
---------------
330330

331-
Rendering is handled by the SonataBlockBundle ``sonata_block_render`` twig
332-
function. The block name is either an absolute PHPCR path or the name of the
333-
block relative to the ``cmfMainContent`` document.
334-
335331
To render the example from the :ref:`bundle-block-document` section, just add
336332
the following code to your Twig template:
337333

@@ -385,72 +381,6 @@ response object - typically by rendering a Twig template.
385381
You can also :ref:`embed blocks in WYSIWYG content <tutorial-block-embed>`
386382
using the ``cmf_embed_blocks`` filter.
387383

388-
Embedding Blocks in WYSIWYG Content
389-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
390-
391-
.. note::
392-
393-
This feature conflicts with the frontend editing provided by CreateBundle,
394-
editing the rendered content will store the rendered block HTML into the
395-
database. There is `discussion going on to fix this`_
396-
397-
The CmfBlockBundle provides a twig filter ``cmf_embed_blocks`` that
398-
looks through the content and looks for special tags to render blocks. To use
399-
the tag, you need to apply the ``cmf_embed_blocks`` filter to your output. If
400-
you can, render your blocks directly in the template. This feature is only a
401-
cheap solution for web editors to place blocks anywhere in their HTML content.
402-
A better solution to build composed pages is to build it from blocks (there
403-
might be a CMF bundle at some point for this).
404-
405-
.. code-block:: jinja
406-
407-
{# template.twig.html #}
408-
{{ page.content|cmf_embed_blocks }}
409-
410-
Make sure to only place this filter where you display the content and not where
411-
editing it, as otherwise your users would start to edit the rendered output of
412-
their blocks. When you apply the filter, your users can use this tag to embed a
413-
block in their HTML content:
414-
415-
.. code-block:: html
416-
417-
%embed-block|/absolute/path/to/block|end%
418-
419-
%embed-block|local-block|end%
420-
421-
The path to the block is either absolute or relative to the current main
422-
content. The actual path to the block must be enclosed with double quotes
423-
``"``. But the prefix and postfix are configurable. The default prefix is
424-
``%embed-block|`` and the default postfix is ``|end%``. Say you want
425-
to use ``%%%block:"/absolute/path"%%%`` then you do:
426-
427-
.. configuration-block::
428-
429-
.. code-block:: yaml
430-
431-
# app/config/config.yml
432-
cmf_block:
433-
twig:
434-
cmf_embed_blocks:
435-
prefix: %%%block:"
436-
postfix: "%%%
437-
438-
See also the :ref:`the configuration reference
439-
<reference-config-block-twig-cmf-embed-blocks>`.
440-
441-
.. caution::
442-
443-
Currently there is no security built into this feature. Only enable the
444-
filter for content for which you are sure only trusted users may edit it.
445-
Restrictions about what block can be where that are built into an admin
446-
interface are not respected here.
447-
448-
.. note::
449-
450-
The block embed filter ignores all errors that might occur when rendering a
451-
block and returns an empty string for each failed block instead. The errors
452-
are logged at level WARNING.
453-
454384
Examples
455385
--------
456386

@@ -470,4 +400,3 @@ Read on
470400
.. _`Symfony CMF Sandbox`: https://github.com/symfony-cmf/cmf-sandbox
471401
.. _`prepended configuration`: http://symfony.com/doc/current/components/dependency_injection/compilation.html#prepending-configuration-passed-to-the-extension
472402
.. _`SonataBlockBundle`: https://github.com/sonata-project/SonataBlockBundle
473-
.. _`discussion going on to fix this`: https://github.com/symfony-cmf/BlockBundle/issues/143

0 commit comments

Comments
 (0)