Skip to content
Snippets Groups Projects
Commit 3c94dffb authored by Adrian Lorenc's avatar Adrian Lorenc
Browse files

ISAICP-9055: Update number of imported terms.

parent a0f28a27
No related branches found
No related tags found
1 merge request!207Release 2.1.1
......@@ -20,6 +20,8 @@ class EuOssCatalogueInstallHelper {
*/
public static function createTerms(array $items, array &$context): void {
$termStorage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
$imported = 0;
foreach ($items as $item) {
$existingTerms = $termStorage->loadByProperties([
'name' => $item['name'],
......@@ -28,10 +30,11 @@ public static function createTerms(array $items, array &$context): void {
if (empty($existingTerms)) {
$termStorage->create($item)->save();
$imported++;
}
}
$context['message'] = t('Imported @count terms in controlled vocabularies', [
'@count' => count($items),
'@count' => $imported,
]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment