public function UEditor::getJSSettings in UEditor - 百度编辑器 8
Returns JavaScript settings to be attached.
Most text editors use JavaScript to provide a WYSIWYG or toolbar on the client-side interface. This method can be used to convert internal settings of the text editor into JavaScript variables that will be accessible when the text editor is loaded.
Parameters
\Drupal\editor\Entity\Editor $editor: A configured text editor object.
Return value
array An array of settings that will be added to the page for use by this text editor's JavaScript integration.
Overrides EditorPluginInterface::getJSSettings
See also
\Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()
EditorManager::getAttachments()
1 call to UEditor::getJSSettings()
- UEditor::buildConfigurationForm in src/
Plugin/ Editor/ UEditor.php - Form constructor.
File
- src/
Plugin/ Editor/ UEditor.php, line 352
Class
- UEditor
- Defines a UEditor-based text editor for Drupal.
Namespace
Drupal\ueditor\Plugin\EditorCode
public function getJSSettings(Editor $editor) {
$settings = array();
$settings = $editor
->getSettings();
if (isset($settings['basic'])) {
global $base_url;
$settings['basic']['editorPath'] = $base_url . '/' . drupal_get_path('module', 'ueditor') . '/lib/';
$settings['basic']['serverUrl'] = $base_url . '/ueditor/controller/upload';
$settings['basic']['toolbars'][] = $this
->ueditor_toolbars($settings['basic']['appearance']['toolbars']);
$settings['basic']['enable_formula'] = $this->global_settings['ueditor_enable_formula_editor'];
return $settings['basic'];
}
return $settings;
}