diff --git a/blocks_pipelines.php b/blocks_pipelines.php index 5bdd6bd06a7c12f76ad19548a3440bab2ce3523b..91dc86ddee7263bae0d24c2bd387d6045b0d105a 100644 --- a/blocks_pipelines.php +++ b/blocks_pipelines.php @@ -13,6 +13,38 @@ if (!defined('_ECRIRE_INC_VERSION')) { return; } +/** + * Afficher la gestion des blocs sur la vue des objets + * + * @pipeline afficher_contenu_objet + * @param array $flux Données du pipeline + * @return array Données du pipeline + **/ +function blocks_afficher_contenu_objet($flux) { + if ( + ($objet = $flux['args']['type']) + && ($args = $flux['args'] ?? []) + && ($id_objet = $args['id_objet'] ?? null) + && ($objets = lire_config('blocks/objets')) + && in_array(table_objet_sql($objet), $objets) + ) { + $texte = recuperer_fond( + 'prive/squelettes/inclure/blocs_objet', + [ + 'objet' => $objet, + 'id_objet' => $id_objet + ], + ['ajax' => true] + ); + if ($p = strpos($flux['data'], '<!--affiche_milieu-->')) { + $flux['data'] = substr_replace($flux['data'], $texte, $p, 0); + } else { + $flux['data'] .= $texte; + } + } + return $flux; +} + /** * Ajouter les objets sur les vues des parents directs * diff --git a/paquet.xml b/paquet.xml index ff2dee5f96dd2a1b1b9901f19e1a8b7c7ca6f082..2feb5211c4c5a3dd3dfbc401356ae94637394c59 100644 --- a/paquet.xml +++ b/paquet.xml @@ -23,6 +23,7 @@ <pipeline nom="declarer_tables_auxiliaires" inclure="base/blocks.php" /> <pipeline nom="affiche_enfants" inclure="blocks_pipelines.php"/> + <pipeline nom="afficher_contenu_objet" inclure="blocks_pipelines.php"/> <pipeline nom="boite_infos" inclure="blocks_pipelines.php"/> <pipeline nom="objet_compte_enfants" inclure="blocks_pipelines.php"/> <pipeline nom="optimiser_base_disparus" inclure="blocks_pipelines.php"/>