shahroq / whale_c5_cheat_sheet

concrete5 Cheat Sheet
MIT License
70 stars 33 forks source link

Rich Text Editor #24

Closed linuxoid closed 4 years ago

linuxoid commented 4 years ago
  1. Simple RTE use:
    $editor = $app->make('editor');
    echo $editor->outputStandardEditor('content', $content);
  2. List RTE plugins:
    $editor = $app->make('editor');
    $pluginManager = $editor->getPluginManager();
    $plugins = $pluginManager->getAvailablePlugins();
    foreach ($plugins as $p) {
    echo $p->getKey().' - '.$p->getName().'<br>';
    }
  3. Strip all RTE plugins and enable some as required:
    $editor = $app->make('editor');
    $pluginManager = $editor->getPluginManager();
    $selectedPlugins = $pluginManager->getSelectedPlugins();
    $allowedPlugins = ['wysiwygarea', 'image', 'image2', 'undo', 'toolbar', 'clipboard', 'format', 'basicstyles', 'justify'];
    $pluginManager->deselect($selectedPlugins);
    $pluginManager->select($allowedPlugins);
    echo $editor->outputStandardEditor('content', $content);
shahroq commented 4 years ago

@linuxoid Thanks Alex. There are already a section listing some of the most useful methods for the Rich Text Editor helper. Regarding the helpers, I tried not to clutter the page with all available methods, and bring just a handful of most useful ones. There is also path to the helper file if user mean to check other available methods.