Commit e64d7536 authored by catch's avatar catch

Issue #2898886 by Sam152, timmillwood: ContentModerationConfigureForm should...

Issue #2898886 by Sam152, timmillwood: ContentModerationConfigureForm should use inline list in place of concatenated markup
parent d1227108
...@@ -178,9 +178,15 @@ public function ajaxCallback() { ...@@ -178,9 +178,15 @@ public function ajaxCallback() {
$selected_bundles[$bundle_id] = $bundle['label']; $selected_bundles[$bundle_id] = $bundle['label'];
} }
} }
$selected_bundles_list = [
'#theme' => 'item_list',
'#items' => $selected_bundles,
'#context' => ['list_style' => 'comma-list'],
'#empty' => $this->t('none'),
];
$response = new AjaxResponse(); $response = new AjaxResponse();
$response->addCommand(new CloseDialogCommand()); $response->addCommand(new CloseDialogCommand());
$response->addCommand(new HtmlCommand('#selected-' . $this->entityType->id(), !empty($selected_bundles) ? implode(', ', $selected_bundles) : $this->t('none'))); $response->addCommand(new HtmlCommand('#selected-' . $this->entityType->id(), $selected_bundles_list));
return $response; return $response;
} }
......
...@@ -94,14 +94,21 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta ...@@ -94,14 +94,21 @@ public function buildConfigurationForm(array $form, FormStateInterface $form_sta
} }
} }
$selected_bundles_list = [
'#theme' => 'item_list',
'#items' => $selected_bundles,
'#context' => ['list_style' => 'comma-list'],
'#empty' => $this->t('none'),
];
$form['entity_types_container']['entity_types'][$entity_type->id()] = [ $form['entity_types_container']['entity_types'][$entity_type->id()] = [
'type' => [ 'type' => [
'label' => ['#markup' => '<strong>' . $this->t('@bundle types', ['@bundle' => $entity_type->getLabel()]) . '</strong>'], '#type' => 'inline_template',
'selected' => [ '#template' => '<strong>{{ label }}</strong></br><span id="selected-{{ entity_type_id }}">{{ selected_bundles }}</span>',
'#prefix' => '<br/><span id="selected-' . $entity_type->id() . '">', '#context' => [
'#markup' => !empty($selected_bundles) ? implode(', ', $selected_bundles) : $this->t('none'), 'label' => $this->t('@bundle types', ['@bundle' => $entity_type->getLabel()]),
'#suffix' => '</span>', 'entity_type_id' => $entity_type->id(),
], 'selected_bundles' => $selected_bundles_list,
]
], ],
'operations' => [ 'operations' => [
'#type' => 'operations', '#type' => 'operations',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment