Add more fonts to the Redactor-Plugin "font family"

This is a community-contributed tutorial. This tutorial is over a year old and may not apply to your version of Concrete CMS.
Aug 18, 2015

Note: This has been tested only in version 5.7.4.2 Also, this is for packages or packaged themes.

  1. Copy the fontfamily.js from /concrete/js/build/vendor/redactor/ to your package folder: /packages/package_handle/js/build/vendor/redactor/
  2. Rename the file to something unique like allmyfonts.js
  3. In the allmyfonts.js file , rename the RedactorPlugins function from fontfamily to allmyfonts:

    //...
    (function($) {
        RedactorPlugins.allmyfonts = function() {
        return {
    //...
    
  4. Still in the allmyfonts.js file, add your fonts to the array fonts in the init() function:

    //...
    init: function () {
        var fonts = [ 'Verdana', 'Helvetica', 'Georgia', 'Times New Roman', 'Monospace', 'Ubuntu', 'And So on' ];
        var that = this;
        var dropdown = {};
    //...
    
  5. In the package controllers on_start() method, register the allmyfonts.js file:

    public function on_start()
    {
        $pkg = $this;
        $al = Asset\AssetList::getInstance();
        $al->register(
            'javascript', 'allmyfonts', 'js/build/vendor/redactor/allmyfonts.js', array('position' => \Asset::ASSET_POSITION_FOOTER), $pkg
        );
        $al->registerGroup('allmyfonts', array(
            array('javascript', 'allmyfonts'),
        ));
        $plugin = new Plugin();
        $plugin->setKey('allmyfonts');
        $plugin->setName('allmyfonts');
        $plugin->requireAsset('allmyfonts');
        \Core::make('editor')->getPluginManager()->register($plugin);
    }
    
  6. Call (require) your allmyfonts.js in the single page controllers on_start()method:

    public function on_start()
    {
        $this->requireAsset('javascript', 'allmyfonts');
        // Important! Don't forget to call the `parent::on_start()` method at the end!
         parent::on_start();
    }
    
  7. On the single page, initialize the redactor:

    $editor = Core::make('editor');
    $editor->getPluginManager()->select('allmyfonts');
    
  8. And call it in the DOM:

    print $editor->outputStandardEditor('text_area_name_attribute', 'content');
    
  9. Clear cache & Reinstall the package

Recent Tutorials
How To Add Page Last Updated To Your Concrete CMS Pages
Mar 7, 2023

Concrete CMS has a page attribute you can add to a global area called "Page Date Modified." Here's how to add it

How To Exclude Subpages from Navigation
Dec 24, 2022

How to exclude subpages from navigation - useful for a news or blog link in your main navigation where you don't want all the subpages to appear in a drop down menu.

How Can I Change The Maximum Size Of Uploaded files
Dec 13, 2022

This tutorial explains how to update your php settings.

Updating Concrete Themes from Version 8 to Version 9
Nov 24, 2022

This tutorial covers commonly encountered issues when upgrading a Concrete CMS theme from version 8 to version 9

Transferring ownership of an add-on and a theme
Nov 15, 2022
By katzueno.

If you encounter a Concrete CMS add-on or theme that you love but not being maintained, you may want to ask the author to help or take over the add-on or theme. Here is the quick step-by-step guide of how to transfer the ownership.

How to update Add-Ons if not on the Update Add-Ons Menu item
Jul 4, 2022

How to manually download an add-on and update it when your site's core versions isn't considered compatible with the add-on version.

Was this information useful?
Thank you for your feedback.