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

modules/degov_paragraph_webform/degov_paragraph_webform.install
<?php

use Drupal\Core\Database\Connection;
use Drupal\degov_common\Common;

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

/**
 * Fix webform paragraph id for existing content.
 */
function degov_paragraph_webform_update_8001() {
  /**
   * @var Connection $database
   */
  $database = \Drupal::service('database');

  $database->query("UPDATE {paragraph__field_sub_title} SET bundle = 'webform' WHERE bundle = 'webformular'");
  $database->query("UPDATE {paragraph_revision__field_sub_title} SET bundle = 'webform' WHERE bundle = 'webformular'");
  $database->query("UPDATE {paragraph_revision__field_title} SET bundle = 'webform' WHERE bundle = 'webformular'");
  $database->query("UPDATE {paragraph_revision__field_title_link} SET bundle = 'webform' WHERE bundle = 'webformular'");
  $database->query("UPDATE {paragraphs_item} SET type = 'webform' WHERE type = 'webformular'");
  $database->query("UPDATE {paragraphs_item_field_data} SET type = 'webform' WHERE type = 'webformular'");
  $database->query("UPDATE {paragraph__field_title} SET bundle = 'webform' WHERE bundle = 'webformular'");
  $database->query("UPDATE {paragraph__field_title_link} SET bundle = 'webform' WHERE bundle = 'webformular'");
}

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

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