You are here

function _opigno_video_app_enable_video_plugin in Opigno Video App 7

Enable Opigno Video plugin.

2 calls to _opigno_video_app_enable_video_plugin()
opigno_video_app_install in ./opigno_video_app.install
Implements hook_install().
opigno_video_app_update_7001 in ./opigno_video_app.install
Enable/disable Video plugins/filters.

File

./opigno_video_app.install, line 349
Contains install instructions and logic

Code

function _opigno_video_app_enable_video_plugin() {

  // Get current saved settings.
  $ckeditor_settings_query = db_select('wysiwyg', 'w')
    ->fields('w', array(
    'settings',
  ))
    ->condition('w.format', 'html')
    ->condition('w.editor', 'ckeditor')
    ->execute()
    ->fetchField();
  if (!empty($ckeditor_settings_query)) {
    $ckeditor_settings = unserialize($ckeditor_settings_query);
    if (!empty($ckeditor_settings['buttons'])) {

      // Enable Opigno Video plugin.
      $ckeditor_settings['buttons']['drupal']['opigno_video'] = 1;

      // Insert new profile data.
      db_update('wysiwyg')
        ->condition('format', 'html')
        ->condition('editor', 'ckeditor')
        ->fields(array(
        'settings' => serialize($ckeditor_settings),
      ))
        ->execute();
    }
  }
  wysiwyg_profile_cache_clear();
}