浏览代码

add setvariable sitemap

cedric 3 年之前
父节点
当前提交
c68e01d090
共有 1 个文件被更改,包括 19 次插入0 次删除
  1. 19 0
      chcreateur.php

+ 19 - 0
chcreateur.php

@@ -49,6 +49,7 @@ class Chcreateur extends Module implements WidgetInterface
 			//&& $this->registerHook('displayBlockPosition2')
 			&& $this->registerHook('displayHeader')
 			&& $this->registerHook('ModuleRoutes')
+			&& $this->registerHook('ActionFrontControllerSetVariables')
 			&& $this->Register_SQL()
 			&& $this->_installTab()
 			&& Configuration::updateValue('CHCREATEUR_TITLE', 'Nos createurs')
@@ -613,4 +614,22 @@ class Chcreateur extends Module implements WidgetInterface
             $rule = 'xipblog-single-module';
         }
     }
+
+	public function hookActionFrontControllerSetVariables()
+	{	
+		$posts = Chcreapost::getAllSelections(5);
+		$links = [];
+		foreach($posts as $post ) {
+			$links[] = [
+				'id' => 'chcreapost-' . $post['id_chcreaposts'],
+				'label' => $post['post_title'],
+				'url' => $post['link']
+			];
+		}
+		return [
+			'title' => Configuration::get('CHCREATEUR_TITLE'),
+			'links' => $links,
+		];
+	}
+
 }