Pixel & Tonic

Wygwam

version works on just rated
2.1.2 EE1 & EE2 $35
Buy Now Get Help

Using the wygwam_config Hook

Wygwam 2.0.1 added its own extension hook called “wygwam_config”. This hook will enable you to override your Wygwam fields’ CKEditor config settings right on page load, taking your Wygwam customizations to a whole new level.

If you’ve never written an ExpressionEngine extension before, you can learn how within the Docs for EE1 and EE2.

We’ve written a sample extension called “Wygwam Upload Tags”, which will parse your Upload Directory’s Server Path and URL settings for {screen_name}, {member_id}, and {group_id} tags.

Hook Parameters

$config
The array of config settings that are about to be JSON-ified and sent to CKEditor during field initialization.
$settings
The full array of your field’s settings, as they were before being translated into the $config array.

Return Data?

Yes – your extension should return the $config array, whether or not you’ve modified it in any way.

Appearance of Hook in the Code

ft.wygwam.ee1.php (EE1)

if ($EXT->active_hook('wygwam_config'))
{
    $config = $EXT->call_extension('wygwam_config', $config, $settings);
}

ft.wygwam.ee2.php (EE2)

if ($this->EE->extensions->active_hook('wygwam_config'))
{
    $config = $this->EE->extensions->call('wygwam_config', $config, $all_settings);
}