The IvoazContentEditableBundle
provides a twig extension for editable content
with internationalization support in Symfony framework.
Example usage:
<h1>{{ 'Go ahead, edit away!' | contenteditable }}</h1>
This saves the content of the current locale in the database and lets a user
with a ROLE_ADMIN
permission edit the content with the browser's
content editable
feature.
Here's another example with a larger content:
{% contenteditable "content_editable_description" %}
<h2>HTMLElement.contentEditable</h2>
<p>The <strong><code>HTMLElement.contentEditable</code></strong> property is used to indicate whether or not the element is editable.</p>
{% contenteditable %}
- PHP >=5.5
- Symfony ~2.8|~3.0
- Doctrine ORM ~2.4
- Twig ~1.23
Open a command console, enter your project directory and execute the following command to download the latest version of this bundle:
$ composer require ivoaz/content-editable-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Ivoaz\Bundle\ContentEditableBundle\IvoazContentEditableBundle(),
);
// ...
}
// ...
}
Contents are stored in the database, so you need to update the schema:
$ bin/console doctrine:schema:update --force
Now configure the routing with the prefix you want:
# app/config/routing.yml
ivoaz_contente_ditable:
resource: "@IvoazContentEditableBundle/Resources/config/routing.xml"
prefix: admin/contenteditable
Lastly, if you are not making your own editor, install the assets needed for the default editor:
$ bin/console assets:install --symlink
For more detailed information about the features of this bundle, please refer to the documentation.
This bundle is released under the MIT license