You are here

function panopoly_widgets_update_7016 in Panopoly Widgets 7

Make sure that users can insert into the WYSIWYG.

File

./panopoly_widgets.install, line 375
An installation file for Panopoly Widgets

Code

function panopoly_widgets_update_7016() {

  // Panopoly 1.29 was released without granting this permission by default, so
  // new sites launched on that version won't have it set. To avoid granting it
  // in situations where it was explicity removed on other sites, we only grant
  // it to roles that have the 'access media browser' permission (just like in
  // the media_wysiwyg_update_7201() when the permission was added by Media).
  if (module_exists('media_wysiwyg')) {
    $roles = user_roles(TRUE, 'access media browser');
    foreach ($roles as $rid => $role) {
      user_role_grant_permissions($rid, array(
        'use media wysiwyg',
      ));
    }
  }
}