From b655b80f648c9fb39ad5f4cf59328d7662522f20 Mon Sep 17 00:00:00 2001 From: Cerdic <cedric@yterium.com> Date: Wed, 24 Mar 2021 11:09:54 +0100 Subject: [PATCH] Un filtre |objet_trouver_enfants en plus et permettre d'appeler les filtre |objet_trouver_enfants et |objet_trouver_parent en syntaxe ```[(#ID_OBJET|objet_trouver_enfants{#OBJET})]``` (avec l'id en premier donc) --- ecrire/inc/filtres.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ecrire/inc/filtres.php b/ecrire/inc/filtres.php index 5d36363491..5904a559e9 100644 --- a/ecrire/inc/filtres.php +++ b/ecrire/inc/filtres.php @@ -5266,6 +5266,7 @@ function identifiant_slug($texte, $type = '', $options = array()) { return $texte; } + /** * Prépare un texte (issu d'une chaine de langue historique) pour un affichage en label ou titre * @@ -5295,6 +5296,27 @@ function uniformiser_label(string $text, bool $ucfirst = true) : string { * @return array */ function filtre_objet_trouver_parent_dist($objet, $id_objet) { + // compatibilite signature inversee + if (is_numeric($objet) and !is_numeric($id_objet)) { + list($objet, $id_objet) = [$id_objet, $objet]; + } include_spip('base/objets'); return objet_trouver_parent($objet, $id_objet); } + + +/** + * Cherche les enfants d'un contenu précis + * + * @param string $objet + * @param int|string $id_objet + * @return array + */ +function filtre_objet_trouver_enfants_dist($objet, $id_objet) { + // compatibilite signature inversee + if (is_numeric($objet) and !is_numeric($id_objet)) { + list($objet, $id_objet) = [$id_objet, $objet]; + } + include_spip('base/objets'); + return objet_trouver_enfants($objet, $id_objet); +} -- GitLab