index page projets
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user