index page projets

This commit is contained in:
Valentin
2024-11-05 01:44:18 +01:00
parent 018960837d
commit bd1b450a45
34 changed files with 1084 additions and 382 deletions

View File

@@ -26,6 +26,9 @@ class SitesMap extends BlockBase {
$allSites = \Drupal::entityTypeManager()->getStorage('node')
->loadByProperties(['type' => 'projet', 'status' => 1]);
$intro_text = \Drupal::entityTypeManager()->getStorage('config_pages')
->load('2')->get('field_intro')-> value;
$sites_paths = "";
foreach($allSites as $index => $site){
@@ -35,11 +38,8 @@ class SitesMap extends BlockBase {
$link_options = ['absolute' => FALSE, 'attributes' => ['class' => 'site-link']];
$site_link_object = Link::createFromRoute("voir le site", 'entity.node.canonical', ['node' => $site->id()], $link_options);
// $link = $site_link_object->toString()->getGeneratedLink();
$href = $site_link_object->getUrl()->toString();
// $datacontent = htmlspecialchars("<strong>$title</strong><br>$subtitle<br>$link");
$geofield = $site->get('field_carte')->get(0);
$lon = $geofield->lon;
$lat = $geofield->lat;
@@ -60,6 +60,7 @@ class SitesMap extends BlockBase {
'svg_mapsites' => [
'#theme' => 'svg_mapsites',
'#sites' => $sites_paths,
'#intro' => $intro_text,
'#attached' => [
'library' => [
'erable_mod/sites_map_block',
@@ -69,9 +70,6 @@ class SitesMap extends BlockBase {
];
return $return;
// return [
// '#markup' => $this->t('Hello, Sites Map!'),
// ];
}
public function getCacheMaxAge() {
return 0;