Download the PHP package gibilogic/tinymce-bundle without Composer
On this page you can find all versions of the php package gibilogic/tinymce-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package tinymce-bundle
TinymceBundle
NOTE! This repo has been forked from stfalcon/TinymceBundle because it was no longer maintained. Documentation / copyright info / naming still reference the old repo, it will be fixed along the way.
This bundle makes it very easy to add the TinyMCE WYSIWYG editor to your Symfony2 project.
Installation
Installation by Composer
NOTE! This version of TinyMCE bundle intended for TinyMCE version 4 and works only with Symfony version >= 2.1. To upgrade your configuration, please read UPGRADE.md
Add TinyMCE bundle as a dependency to the composer.json of your application with the following console command
composer require gibilogic/tinymce-bundle
Add TinyMCE automatic symlinking
"scripts": {
"post-install-cmd": [
"Stfalcon\\Bundle\\TinymceBundle\\Composer\\ScriptHandler::createSymlink"
],
"post-update-cmd": [
"Stfalcon\\Bundle\\TinymceBundle\\Composer\\ScriptHandler::createSymlink"
]
},
Add StfalconTinymceBundle to your application kernel.
The bundle needs to copy the resources necessary to the web folder. You can use the command below:
Include in template
This bundle comes with an extension for Twig. This makes it very easy to include the TinyMCE Javascript into your pages. Add the tag below to the places where you want to use TinyMCE. It will output the complete Javascript, including <script>
tags. Add it to the bottom of your page for optimized performance.
You can also override the default configuration by passing an option like this:
This function allow a second parameter that let you chose if the given configuration must replace the orignal configuration or be merged it. True
will replace, False
will merge (default: false
).
Base configuration
By default, tinymce is enabled for all textareas on the page. If you want to customize it, do the following:
Add class "tinymce" to textarea field to initialize TinyMCE.
If you want to use jQuery version of the editor set the following parameters:
Attention: The id
attribute on the textarea
tag is mandatory if you are using the non-jQuery version.
The option include_jquery
allows you to load external jQuery library from the Google CDN. Set it to true
if you haven't included jQuery on your page.
If you are using FormBuilder, use an array to add the class, you can also use the theme
option to change the
used theme to something other than 'simple' (i.e. on of the other defined themes in your config - the example above
defined 'bbcode'). e.g.:
Localization
You can change the language of your TinyMCE editor by adding language selector into top level of configuration, something like:
NOTE! As there is no way to set custom language for each instance of editor, this option set on language for all instances.
In the example we set default language from the parameters.ini. Of course you can set your default language passing the language code (ru
or ru_RU
, en
or en_US
)
If language parameter isn't set, the default language will be get from the session.
Custom configurations
According to the TinyMCE documentation you can configure your editor as you wish. Below is an almost full list of available parameters that you can configure by yourself:
NOTE! All the options set in
tinymce_config
are passed as-is to TinyMCE. So there is no restriction to set some TinyMCE custom config parameter.
External plugins support
If you want to load some external plugins which are situated in your bundle, you should configure it as in the example:
Custom buttons
You can add some custom buttons to editor's toolbar (See: http://www.tinymce.com/tryit/button.php, http://www.tinymce.com/wiki.php/api4:method.tinymce.Editor.addButton)
First of all you should describe it in your config:
And you should create a callback functions tinymce_button_
for your buttons, based on their button ID:
Custom CSS
This option enables you to specify a custom CSS file that extends the theme content CSS. This CSS file is the one used within the editor (the editable area). This option can also be a comma separated list of URLs.
If you specify a relative path, it is resolved in relation to the URL of the (HTML) file that includes TinyMCE, NOT relative to TinyMCE itself.
NOTE! Read Official TinyMCE documentation for more details: http://www.tinymce.com/wiki.php/Configuration:content_css
Init Event
As $(document).ready() in jQuery you can listen to the init event as well in Tinymce.
To do so you must edit your config and set use_callback_tinymce_init
to true.
app/config/config.yml
:
And then create a javascript callback function named callback_tinymce_init
as follow
How to init TinyMCE for dynamically loaded elements
To initialize TinyMCE for new loaded textareas you should just call initTinyMCE()
function.
Example for Sonata Admin Bundle
All versions of tinymce-bundle with dependencies
symfony/symfony Version >=2.1
sensio/distribution-bundle Version >=3.0.12
tinymce/tinymce Version ~4.0
twig/twig Version ~1.12|~2.0