ivoaz/content-editable-bundle

This bundle provides a twig extension for editable content with internationalization support.

dev-master / 1.0.x-dev 2016-09-30 13:25 UTC

This package is not auto-updated.

Last update: 2024-11-09 20:07:08 UTC


README

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 %}

Build Status Build Status Code Coverage Scrutinizer Code Quality Total Downloads Latest Stable Version

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:

$ 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.

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:

<?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:

$ bin/console doctrine:schema:update --force

Step 4: Configure the routing

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

Step 5: Install the assets

Lastly, if you are not making your own editor, install the assets needed for the default editor:

$ bin/console assets:install --symlink

Documentation

For more detailed information about the features of this bundle, please refer to the documentation.

License

This bundle is released under the MIT license