function InstallHelper::processTerm
Same name in other branches
- 9 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::processTerm()
- 10 core/profiles/demo_umami/modules/demo_umami_content/src/InstallHelper.php \Drupal\demo_umami_content\InstallHelper::processTerm()
- 11.x 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.
1 call to InstallHelper::processTerm()
- InstallHelper::processContent in core/
profiles/ demo_umami/ modules/ demo_umami_content/ src/ InstallHelper.php - Process content into a structure that can be saved into Drupal.
File
-
core/
profiles/ demo_umami/ modules/ demo_umami_content/ src/ InstallHelper.php, line 345
Class
- InstallHelper
- Defines a helper class for importing default content.
Namespace
Drupal\demo_umami_contentCode
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.