backender/epiceditor-bundle

Symfony2 bundle for easy integration of the EpicEditor

Installs: 85

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 1

Language:JavaScript

Type:symfony-bundle

dev-master 2013-02-08 22:10 UTC

This package is not auto-updated.

Last update: 2024-11-09 14:29:18 UTC


README

This bundle provides a EpicEditor integration for your Symfony2 Project. It simply adds the form field type epiceditor to the Form Component.

For more information about EpicEditor see: http://oscargodson.github.com/EpicEditor/

Installation

  1. Add BackenderEpiceditorBundle to your composer.json
  2. Enable the bundle
  3. Install bundle assets
  4. Configure the bundle (optional)
  5. Add the editor to a form

Step 1: Add BackenderEpiceditorBundle to your composer.json

{
    "require": {
        "Backender/epiceditor-bundle": "*"
    }
}

Update your project dependencies:

php composer.phar update Backender/epiceditor-bundle

Step 2: Enable the bundle

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Backender\EpiceditorBundle\BackenderEpiceditorBundle(),
    );
}

Step 3: Install bundle assets

$ php ./app/console assets:install web --symlink

--symlink is optional

Step 4: Configure the bundle (optional)

For a full configuration dump use:

$ php ./app/console config:dump-reference BackenderEpiceditorBundle

An example configuration:

backender_epiceditor:  
    class:                Backender\EpiceditorBundle\Form\Type\EpiceditorType 
    container:            epiceditor 
    basepath:             /web/bundles/backenderepiceditor 
    clientSideStorage:    true 
    localStorageName:     epiceditor 
    parser:               marked 
    focusOnLoad:          false 
    file:                 
        name:                 epiceditor 
        defaultContent:       
        autoSave:             100 
    theme:                
        base:                 /themes/base/epiceditor.css 
        preview:              /themes/preview/github.css 
        editor:               /themes/editor/epic-dark.css 
    shortcut:             
        modifier:             18 
        fullscreen:           70 
        preview:              80 
        edit:                 79 

Or even overwrite the configuration within a FormBuilder (see Step 5).

Step 5: Add the editor to a form

Example form:

<?php

$form = $this->createFormBuilder($post)
    ->add('content', 'epiceditor', array(
            'container'             => 'epiceditor',
            'basepath'              => '/~marc/blog/web/bundles/backenderepiceditor',
            'clientSideStorage'     => true,
            'localStorageName'      => 'epiceditor',
            'parser'                => 'marked',
            'focusOnLoad'           => false,
            'file'                  => array(
                'name'              => 'epiceditor',
                'defaultContent'    => '',
                'autoSave'          => 100
            ),
            'theme'                 => array(
                'base'              => '/themes/base/epiceditor.css',
                'preview'           => '/themes/preview/github.css',
                'editor'            => '/themes/editor/epic-dark.css'
            ),
            'shortcut'              => array(
                'modifier'          => 18,
                'fullscreen'        => 70,
                'preview'           => 80,
                'edit'              => 79
            )
        ))
        ->getForm()
;

Note: All parameters from config.yml can be overwritten in a form (excluding class).

##Contribute

If the bundle doesn't allow you to customize an option, I invite you to fork the project, create a feature branch, and send a pull request.

To ensure a consistent code base, you should make sure the code follows the Coding Standards.

##License

This bundle is under the MIT license. See the complete license here.

Next Steps

  • Testing is coming soon