Allow custom styles to be used


Allow custom style box (see screenshot) to be configured in XML files per bundle. The styles in the XML files in each bundle are all added to the style_formats section.

Required changes:

  • In vendor/integrated/formtype-bundle/Integrated/Bundle/FormTypeBundle/Resources/views/Form/form_div_layout.html.twig the Tinymce toolbar button "formatselect" need to be replaced by "styleselect".

  • In vendor/integrated/formtype-bundle/Integrated/Bundle/FormTypeBundle/Resources/views/Form/form_div_layout.html.twig the style_formats need to be added:
    style_formats: [
    {title: 'Heading 2', block: 'h2' },
    {title: 'Heading 3', block: 'h3' },
    {title: 'Heading 4', block: 'h4' },
    {title: 'Heading 5', block: 'h5' },
    {title: 'Preformatted (fixed font)', block: 'pre' },
    {title: 'Custom style 1', block: 'div', classes: 'further-reading', wrapper : true},
    {title: 'PHP code', block: 'pre', classes: 'brush: php' }

  • In the example above the "Custom style 1" and "PHP code" are custom styles. They need to be read from an XML file. Each bundle can contain a contentstyle XML file in Resources/config/contentstyle/contentstyle.xml. (in vendor/integrated/solr-bundle/Integrated/Bundle/SolrBundle/DependencyInjection/CompilerPass/RegisterConfigFileProviderPass.php there is an example of config files for Solr that are read for each bundle.

  • The XML file must contain the options that are used in the style_formats above

  • The XML file must also contain a content_css option. This will be added to the content_css of the Tinymce configuration (comma seperated):
    content_css: "/bundles/integratedformtype/css/tinymce.content.css,/custom/content/css/url.css",

  • Each bundle can have a contentstyle.xml file and all the styles have to be merged to be able to choose them in the editor. For example if you write a PHP-code-highlighter bundle it can provide styles for PHP-code highlighting that can be chosen in the editor.

Technical tasks


Deployment actions



Ger Jan van den Bosch
November 16, 2015, 3:05 PM

I didn't check the PSR standard because i can't checkout this repo.

Ger Jan van den Bosch
November 18, 2015, 7:50 AM

code review






Fix versions