You are here

protected function InstallHelper::processContent in Drupal 10

Same name and namespace in other branches
  1. 8 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::processContent()
  2. 9 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::processContent()

Process content into a structure that can be saved into Drupal.

Parameters

string $bundle_machine_name: Current bundle's machine name.

array $content: Current content array that needs to be structured.

string $langcode: Current language code.

Return value

array Structured content.

File

core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php, line 675

Class

InstallHelper
Defines a helper class for importing default content.

Namespace

Drupal\demo_umami_content

Code

protected function processContent($bundle_machine_name, array $content, $langcode) {
  switch ($bundle_machine_name) {
    case 'recipe':
      $structured_content = $this
        ->processRecipe($content, $langcode);
      break;
    case 'article':
      $structured_content = $this
        ->processArticle($content, $langcode);
      break;
    case 'page':
      $structured_content = $this
        ->processPage($content, $langcode);
      break;
    case 'banner_block':
      $structured_content = $this
        ->processBannerBlock($content, $langcode);
      break;
    case 'disclaimer_block':
      $structured_content = $this
        ->processDisclaimerBlock($content);
      break;
    case 'footer_promo_block':
      $structured_content = $this
        ->processFooterPromoBlock($content, $langcode);
      break;
    case 'image':
      $structured_content = $this
        ->processImage($content);
      break;
    case 'recipe_category':
    case 'tags':
      $structured_content = $this
        ->processTerm($content, $bundle_machine_name);
      break;
    default:
      break;
  }
  return $structured_content;
}