value format * * returns html markup. */ public static function generateAddLinks($baseEntityType, $title, $query = []) { $bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($baseEntityType); $title = t($title); $markup = "

$title:

"; foreach($bundles as $bundle_id => $bundle) { $label = t($bundle['label']); $url = \Drupal\Core\Url::fromRoute("entity.$baseEntityType.add_form", [$baseEntityType . '_type' => $bundle_id]); $url->setOption('query', $query); $link = \Drupal\Core\Link::fromTextAndUrl($label, $url)->toString(); $markup .= "

$link

"; } return ""; } }