public function N1ED::getFile in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2
Returns the Drupal root-relative file path to the plugin JavaScript file.
Note: this does not use a Drupal library because this uses CKEditor's API.
Return value
string|false The Drupal root-relative path to the file, FALSE if an internal plugin.
Overrides CKEditorPluginInterface::getFile
See also
https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_resourceManager....
File
- src/
Plugin/ CKEditorPlugin/ N1ED.php, line 59
Class
- N1ED
- Defines plugin.
Namespace
Drupal\n1ed\Plugin\CKEditorPluginCode
public function getFile() {
$settings = \Drupal::config('n1ed.settings');
$apiKey = $settings
->get('apikey') ?: 'N1D8DFLT';
$version = $settings
->get('version') ?: '';
if ($version === '') {
$version = 'latest';
}
$urlCache = $settings
->get('urlCache') ?: '';
if ($settings
->get('selfHosted')) {
return selfHostedPath . 'N1EDEco/plugin.js';
}
else {
if ($urlCache === '') {
// Fix for: https://www.drupal.org/project/n1ed/issues/3111919
// Do not start URL with "https:" prefix.
// Notice about cookies: developers use it to specify debug server to use,
// all other users will use old known cloud.n1ed.com address
return '//' . (isset($_COOKIE["N1ED_PREFIX"]) ? $_COOKIE["N1ED_PREFIX"] . "." : "") . 'cloud.n1ed.com/cdn/' . $apiKey . '/' . $version . '/ckeditor/plugins/N1EDEco/plugin.js';
}
else {
// Fix for: https://www.drupal.org/project/n1ed/issues/3111919
// Do not start URL with "https:" prefix.
if (strpos($urlCache, "http:") === 0) {
$urlCache = substr($urlCache, 5);
}
else {
if (strpos($urlCache, "https:") === 0) {
$urlCache = substr($urlCache, 6);
}
}
return $urlCache . $apiKey . '/' . $version . '/ckeditor/plugins/N1EDEco/plugin.js';
}
}
}