You are here

paragraphs_browser.install in Paragraphs Browser 8

File

paragraphs_browser.install
View source
<?php

/**
 * Migrate old descriptions.
 */
function paragraphs_browser_update_8001() {
  $entityTypeManager = \Drupal::entityTypeManager();
  $paragraphsTypeStorage = $entityTypeManager
    ->getStorage('paragraphs_type');
  $paragraphsType = $paragraphsTypeStorage
    ->loadMultiple();
  foreach ($paragraphsType as $paragraphType) {
    $paragraphsBrowserSettings = $paragraphType
      ->getThirdPartySettings('paragraphs_browser');
    if (!$paragraphType
      ->getDescription() && isset($paragraphsBrowserSettings['description'])) {
      $paragraphType
        ->set('description', $paragraphsBrowserSettings['description']);
      $paragraphType
        ->save();
    }
  }
}

Functions

Namesort descending Description
paragraphs_browser_update_8001 Migrate old descriptions.