public function N1EDSelfHosted::setSelfHostedConfig in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2
File
- src/
Controller/ N1EDSelfHosted.php, line 87
Class
Namespace
Drupal\n1ed\ControllerCode
public function setSelfHostedConfig(string $new_config) : array {
if ($this
->checkSelfHostedFiles()) {
$plugin_file = file_get_contents($this->plugin_file);
$search = '/\\/\\*N1ED-ECO-CONFIG-START\\*\\/(.*?)\\/\\*N1ED-ECO-CONFIG-END\\*\\//s';
$replace = "/*N1ED-ECO-CONFIG-START*/" . $new_config . "/*N1ED-ECO-CONFIG-END*/";
$new_plugin = preg_replace($search, $replace, $plugin_file);
file_put_contents($this->plugin_file, $new_plugin);
$this
->rebuildDependencies();
return [
'error' => null,
'data' => 'ok',
];
}
else {
return $this
->noFilesResponse();
}
}