degov-8.x-2.0/modules/degov_media_audio/degov_media_audio.install

modules/degov_media_audio/degov_media_audio.install
<?php

use Drupal\degov_common\Common;

/**
 * Implements hook_uninstall().
 */
function degov_media_audio_uninstall() {
  // Removes all module type defined content when uninstalling the module.
  Common::removeContent([
    'entity_type' => 'media',
    'entity_bundles' => ['audio'],
  ]);

  // Remove the audio bundle dependency on the entity media browser.
  $dependencies = \Drupal::config('entity_browser.browser.media_browser')
    ->get('dependencies.config');
  foreach ($dependencies as $key => $dependency) {
    if ($dependency == 'media.type.audio') {
      unset($dependencies[$key]);
    }
  }
  $dependencies = array_values($dependencies);
  \Drupal::configFactory()->getEditable('entity_browser.browser.media_browser')
    ->set('dependencies.config', $dependencies)
    ->save(TRUE);

  // Remove the audio tab from the entity media browser.
  $key = "0858526f-05e0-4b00-b8db-e9283a437a1c";
  $widgets = \Drupal::config("entity_browser.browser.media_browser")
    ->get("widgets");
  if (!empty($widgets[$key])) {
    unset($widgets[$key]);
    \Drupal::configFactory()->getEditable("entity_browser.browser.media_browser")
      ->set("widgets", $widgets)
      ->save(TRUE);
  }
}

/**
 * Next module update version is 8011.
 * All update hooks from 1.1 to 1.14 were deleted.
 * There is no upgrade path from 1.1 to 1.14, you need first to update to 1.2
 * and every minor release as well until 1.14 respectively.
 * The fresh install should have all the changes from 1.1 to 1.14.
 */

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc