You are here

function lightning_media_install in Lightning Media 8.3

Same name and namespace in other branches
  1. 8.4 lightning_media.install \lightning_media_install()
  2. 8 lightning_media.install \lightning_media_install()
  3. 8.2 lightning_media.install \lightning_media_install()

Implements hook_install().

File

./lightning_media.install, line 26
Contains install and update routines for Lightning Media.

Code

function lightning_media_install() {

  // Don't do anything during config sync.
  if (\Drupal::isConfigSyncing()) {
    return;
  }
  user_role_grant_permissions('anonymous', [
    'view media',
  ]);
  user_role_grant_permissions('authenticated', [
    'view media',
  ]);

  // Set the icon for the media_browser embed button.
  lightning_media_update_8006();

  // Grant the creator content role permission to use the rich_text format and
  // the media browser.
  if (\Drupal::moduleHandler()
    ->moduleExists('lightning_roles')) {
    lightning_media_modules_installed([
      'lightning_roles',
    ]);
  }

  // Add the media.embedded view mode to the media_browser embed button. It
  // cannot be part of the original embed button config entity because the view
  // mode is itself installed at the same time as the button, as part of this
  // module's default configuration -- which means that it might not exist when
  // the button is installed, resulting in a scary PluginNotFoundException.
  lightning_media_update_8013();
}