/** * Get templates (left column when creating a document) * @Route("/editor/templates", name="editor_templates") * @Method({"GET"}) */ public function editorTemplates() { $editor = new CkEditor($this->container->get('translator.default'), $this->container->get('router')); $templates = $editor->simpleFormatTemplates(); return $this->render('@ChamiloCore/default/javascript/editor/ckeditor/templates.html.twig', ['templates' => $templates]); }
<?php /* For licensing terms, see /license.txt */ require_once '../../global.inc.php'; use Chamilo\CoreBundle\Component\Editor\CkEditor\CkEditor; $template = new Template(); $table = Database::get_main_table(TABLE_MAIN_SYSTEM_TEMPLATE); $sql = "SELECT * FROM {$table}"; $result = Database::query($sql); $templates = Database::store_result($result, 'ASSOC'); if (!empty($templates)) { $editor = new CkEditor(); $templates = $editor->simpleFormatTemplates($templates); $template->assign('templates', $templates); $template->display('default/javascript/editor/ckeditor/templates.tpl'); }
/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $toolBar = $this->toolBar->createToolBar('Introduction'); $config = $toolBar->getNamedToolBarConfig(); $builder->add('introText', 'ckeditor', ['config' => $config])->add('cId', 'hidden')->add('sessionId', 'hidden')->add('tool', 'hidden')->add('SaveIntroText', 'submit'); }