You are here

function varbase_editor_update_8004 in Varbase Editor 9.0.x

Same name and namespace in other branches
  1. 8.7 varbase_editor.install \varbase_editor_update_8004()
  2. 8.4 varbase_editor.install \varbase_editor_update_8004()
  3. 8.5 varbase_editor.install \varbase_editor_update_8004()
  4. 8.6 varbase_editor.install \varbase_editor_update_8004()

Update "Rich editor" to use the CKEditor media embed button.

File

./varbase_editor.install, line 142
Install, update and uninstall functions for the Varbase editor module.

Code

function varbase_editor_update_8004() {

  // Update "Rich editor" editor config.
  $full_html_editor_config = \Drupal::service('config.factory')
    ->getEditable('editor.editor.full_html');
  $full_html_editor_config_file = \Drupal::root() . '/' . drupal_get_path('module', 'varbase_editor') . '/config/install/editor.editor.full_html.yml';
  $full_html_editor_config_content = file_get_contents($full_html_editor_config_file);
  $full_html_editor_config_content_data = (array) Yaml::parse($full_html_editor_config_content);
  $full_html_editor_config
    ->setData($full_html_editor_config_content_data)
    ->save();

  // Update "Rich editor" filter format config.
  $full_html_format_config = \Drupal::service('config.factory')
    ->getEditable('filter.format.full_html');
  $full_html_format_config_file = \Drupal::root() . '/' . drupal_get_path('module', 'varbase_editor') . '/config/install/filter.format.full_html.yml';
  $full_html_format_config_content = file_get_contents($full_html_format_config_file);
  $full_html_format_config_content_data = (array) Yaml::parse($full_html_format_config_content);
  $full_html_format_config
    ->setData($full_html_format_config_content_data)
    ->save();
}