getChildren(); foreach($children as $child) { if($child->getName() === 'nav'){ $this->nav = $child; // actuellement le noeud nav ne contient aucune info utile et l'envoyer à NavBuilder est inutile $nav_builder = new NavBuilder($this->nav); $nav = $nav_builder->render(); } elseif($child->getName() === 'breadcrumb'){ $this->breadcrumb = $child; $breadcrumb_builder = new BreadcrumbBuilder($this->breadcrumb); $breadcrumb = $breadcrumb_builder->render(); } } $viewFile = self::VIEWS_PATH . $node->getName() . '.php'; if(file_exists($viewFile)) { $node_data = $node->getNodeData(); // titre et description if(!empty($node_data->getData())) { extract($node_data->getData()); } // réseaux sociaux + logo dans l'entête // ?-> est l'opérateur de chainage optionnel $header_logo = Asset::USER_PATH . $node_data->getAssetByRole('header_logo')?->getFileName() ?? ''; $header_background_name = $node_data->getAssetByRole('header_background')?->getFileName(); $header_background = $header_background_name ? Asset::USER_PATH . $header_background_name : ''; $social_networks = ''; // boutons mode admin if($_SESSION['admin']){ // assets dans classe header_additional_inputs $admin_favicon = ' '; $admin_background = ' '; // asset dans classe header_content $admin_header_logo = ' '; // texte dans classe header_content $admin_header_title = ' '; $admin_header_description = ' '; // icônes réseaux sociaux // boucle sur la liste complète de réseaux sociaux foreach(NodeData::$social_networks as $network){ $checked = (isset($social_show[$network]) && $social_show[$network]) ? 'checked' : ''; $href = (isset($social[$network]) && $social[$network] !== '') ? 'href="' . $social[$network] . '"' : ''; $social_networks .= '
' . $this->insertSVG(self::ICON_PATH . $network . '.svg', ['id' => 'header_' . $network . '_content', 'class' => ($checked ? 'svg_fill_red' : '')]) . '
'; // {'has_content': false} => InputToggle ne gèrera pas cette balise } } else{ $admin_favicon = ''; $admin_background = ''; $admin_header_logo = ''; $admin_header_title = ''; $admin_header_description = ''; if(isset($social_show)){ // boucle sur les réseaux sociaux "activés" foreach(array_keys($social_show) as $network){ if($social_show[$network]){ $href = (isset($social[$network]) && $social[$network] !== '') ? 'href="' . $social[$network] . '"' : ''; $social_networks .= '
' . $this->insertSVG(self::ICON_PATH . $network . '.svg', ['id' => 'header_' . $network . '_content','class' => 'svg_fill_red']) . '
'; } } } } ob_start(); require $viewFile; $this->html .= ob_get_clean(); } } }