[9.0.21] liste de pages arborescente dans lien de TinyMCE

This commit is contained in:
Fred Tempez 2019-04-23 19:24:03 +02:00
parent 66d44e4a53
commit 01dee620c5
1 changed files with 21 additions and 6 deletions

View File

@ -553,14 +553,29 @@ class common {
$children = [];
// Exclure les barres
if ($this->getData(['page', $parentId, 'block']) !== 'bar' ) {
$parents [] = ['title' => $this->getData(['page', $parentId, 'title']) ,
'value'=> $rewrite.$parentId
];
foreach($childIds as $childId) {
$parents [] = ['title' => $this->getData(['page', $parentId, 'title']) . ' / '. $this->getData(['page', $childId, 'title']) ,
// Boucler sur les enfants et récupérer le tableau children avec la liste des enfants
foreach($childIds as $childId) {
$children [] = [ 'title' => ' » '. $this->getData(['page', $childId, 'title']) ,
'value'=> $rewrite.$childId
];
];
}
// Traitement
if (empty($childIds)) {
// Pas d'enfant, uniuement l'entrée du parent
$parents [] = ['title' => $this->getData(['page', $parentId, 'title']) ,
'value'=> $rewrite.$parentId
];
} else {
// Des enfants, on ajoute la page parent en premier
array_unshift ($children , ['title' => $this->getData(['page', $parentId, 'title']) ,
'value'=> $rewrite.$parentId
]);
// puis on ajoute les enfants au parent
$parents [] = ['title' => $this->getData(['page', $parentId, 'title']) ,
'value'=> $rewrite.$parentId ,
'menu' => $children
];
}
}
}