You are here

protected function InstallHelper::processTerm 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::processTerm()
  2. 9 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::processTerm()

Process terms for a given vocabulary and filename.

Parameters

array $data: Data of line that was read from the file.

string $vocabulary: Machine name of vocabulary to which we should save terms.

Return value

array Data structured as a term.

File

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

Class

InstallHelper
Defines a helper class for importing default content.

Namespace

Drupal\demo_umami_content

Code

protected function processTerm(array $data, $vocabulary) {
  $term_name = trim($data['term']);

  // Prepare content.
  $values = [
    'name' => $term_name,
    'vid' => $vocabulary,
    'path' => [
      'alias' => '/' . Html::getClass($vocabulary) . '/' . Html::getClass($term_name),
    ],
    'langcode' => 'en',
  ];
  return $values;
}