Skip to content

Commit

Permalink
feat: import export bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian ALEXANDRE committed Jul 8, 2024
1 parent cb8f139 commit f47ff76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,16 @@ public function displayLogs(Job $job, RequestStack $requestStack): Response
$request = $requestStack->getMainRequest();

$countsByLevel = $this->jobService->getJobLogsCountByLevel($job);

$formBuilder = $this->formFactory->createNamedBuilder('logs', FormType::class, null, ['method' => 'GET']);
$formBuilder->add('level', ChoiceType::class, [
'label' => 'job.logs.level',
'choices' => array_flip($countsByLevel),
'choice_label' => function ($choice, int $count, int $level) {
return sprintf('%s (%d)', Logger::getLevelName($level), $count);
'choices' => array_flip([null => array_sum($countsByLevel)] + $countsByLevel),
'choice_label' => function ($choice, int $count, $level) {
return sprintf(
'%s (%d)',
$level ? Logger::getLevelName((int) $level) : 'ALL',
$count
);
},
'attr' => [
'class' => 'ibexa-form-autosubmit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ public function transform($value, array $options = [])
return null;
}
$taxonomy = $options['taxonomy'] ?? null;
if (is_array($value)) {
$entries = [];
foreach ($value as $id) {
$entries[] = $this->loadTaxonomyEntry($id, $taxonomy);
}

return array_filter($entries);
if (is_scalar($value)) {
return $this->loadTaxonomyEntry($value, $taxonomy);
}

$entries = [];
foreach ($value as $id) {
$entries[] = $this->loadTaxonomyEntry($id, $taxonomy);
}

return $this->loadTaxonomyEntry($value, $taxonomy);
return array_filter($entries);
}

/**
Expand Down

0 comments on commit f47ff76

Please sign in to comment.