IvoazContentEditableBundle
The IvoazContentEditableBundle
provides a twig extension for editable content
with internationalization support in Symfony framework., (*1)
Example usage:, (*2)
<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., (*3)
Here's another example with a larger content:, (*4)
{% 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 %}
, (*5)
Requirements
- PHP >=5.5
- Symfony ~2.8|~3.0
- Doctrine ORM ~2.4
- Twig ~1.23
Installation
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the
following command to download the latest version of this bundle:, (*6)
$ 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., (*7)
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:, (*8)
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Ivoaz\Bundle\ContentEditableBundle\IvoazContentEditableBundle(),
);
// ...
}
// ...
}
Step 3: Update the database schema
Contents are stored in the database, so you need to update the schema:, (*9)
$ bin/console doctrine:schema:update --force
Now configure the routing with the prefix you want:, (*10)
# app/config/routing.yml
ivoaz_contente_ditable:
resource: "@IvoazContentEditableBundle/Resources/config/routing.xml"
prefix: admin/contenteditable
Step 5: Install the assets
Lastly, if you are not making your own editor, install the assets needed for the
default editor:, (*11)
$ bin/console assets:install --symlink
Documentation
For more detailed information about the features of this bundle, please refer to
the documentation., (*12)
License
This bundle is released under the MIT license, (*13)