You are here

function n1ed_install in N1ED - Visual editor as CKEditor plugin with Bootstrap support 7

Same name and namespace in other branches
  1. 8.2 n1ed.install \n1ed_install()

Called when installed: attaches N1ED to appropriate formats.

File

./n1ed.install, line 11
Installation hooks for N1ED module.

Code

function n1ed_install() {
  variable_set('n1edApiKey', "N1D7DFLT");
  variable_set('n1edToken', NULL);
  $ckeditor_settings = db_select('ckeditor_settings', 'cs')
    ->condition('name', 'Full')
    ->fields('cs')
    ->execute()
    ->fetchAll();
  $plugins = unserialize($ckeditor_settings[0]->settings);
  $plugins['loadPlugins']['n1ed'] = [
    'name' => 'N1ED',
    'desc' => 'N1ED - visual editor with Bootstrap support',
    'path' => '%base_path%modules/n1ed/plugins/n1ed/',
  ];
  $plugins['allowed_content'] = 'f';
  db_update('ckeditor_settings')
    ->fields([
    'settings' => serialize($plugins),
  ])
    ->condition('name', 'Full')
    ->execute();
  db_update('filter_format')
    ->fields([
    'weight' => -1,
  ])
    ->condition('format', 'full_html')
    ->execute();
  db_update('filter')
    ->fields([
    'status' => 0,
  ])
    ->condition('format', 'full_html')
    ->execute();
}