public function ConditionalFieldController::bundleList in Conditional Fields 8
Same name and namespace in other branches
- 4.x src/Controller/ConditionalFieldController.php \Drupal\conditional_fields\Controller\ConditionalFieldController::bundleList()
Show bundle list of current entity type.
Parameters
string $entity_type: Entity type.
Return value
array Array of page elements to render. Array of page elements to render.
File
- src/
Controller/ ConditionalFieldController.php, line 149
Class
- ConditionalFieldController
- Returns responses for conditional_fields module routes.
Namespace
Drupal\conditional_fields\ControllerCode
public function bundleList($entity_type) {
$output = [];
$bundles = $this->entityTypeBundleInfo
->getBundleInfo($entity_type);
if ($bundles) {
$output['#theme'] = 'admin_block_content';
foreach ($bundles as $bundle_key => $bundle) {
$output['#content'][] = [
'url' => Url::fromRoute('conditional_fields.conditions_list', [
'entity_type' => $entity_type,
'bundle' => $bundle_key,
]),
'title' => $bundle['label'],
];
}
}
else {
$output['#type'] = 'markup';
$output['#markup'] = $this
->t("Bundles not found");
}
return $output;
}