diff --git a/blocks_fonctions.php b/blocks_fonctions.php index 348ac7c106cfd80a134d0fad020de3a1c5e50554..8ebc8af3014c8658846d2ca4f2a767913d9e1314 100644 --- a/blocks_fonctions.php +++ b/blocks_fonctions.php @@ -181,7 +181,7 @@ function generer_TITRE_BLOCK($id_block): string { 'spip_blocks', 'id_block = ' . (int)$id_block )) { - $titre = blocktype_info('titre', $infos['blocktype']); + $titre = blocktype_info($infos['blocktype'], 'titre'); if ($infos['id_objet'] && $infos['objet']) { $titre = generer_objet_info($infos['id_objet'], $infos['objet'], 'titre') . ' - ' . $titre . ' #' . $infos['rang_lien']; } diff --git a/inc/blocks.php b/inc/blocks.php index 4dd86556bd6d2e1036c3472de1f5c19f4a2c37f1..dc6a32fbe661242a391c3403882c0a26d72c7662 100644 --- a/inc/blocks.php +++ b/inc/blocks.php @@ -59,7 +59,7 @@ function blocktypes_lister_types(bool $exclure_ignores = true): array { $yaml_data['titre'] = _T_ou_typo($yaml_data['titre']); $yaml_data['identifiant'] = $blocktype; $yaml_data['description'] = _T_ou_typo($yaml_data['description']); - $yaml_data['icone'] = isset($yaml_data['icone']) ? blocktype_find_icone_path($yaml_data['icone']) : ''; + $yaml_data['icone'] = isset($yaml_data['icone']) ? _blocktype_find_icone_path($yaml_data['icone']) : ''; $liste_blocktypes[$blocktype] = $yaml_data; } @@ -93,10 +93,10 @@ function blocktypes_lister_types(bool $exclure_ignores = true): array { /** * Retrouver l'icone d'un blocktype, la réduire à 16 px * - * @param string $blocktype + * @param string $blocktype Type de bloc (identifiant) * @return string chemin **/ -function blocktype_find_icone_path(string $blocktype): string { +function _blocktype_find_icone_path(string $blocktype): string { static $cache; if (isset($cache[$blocktype])) { return $cache[$blocktype]; @@ -121,6 +121,19 @@ function blocktype_find_icone_path(string $blocktype): string { return $chemin; } +/** + * Obtenir une info de la config d'un block + * + * @param string $blocktype Type de bloc (identifiant) + * @param string $config Clé de la config à retrouver + * @return string|array|null + */ +function blocktype_info(string $blocktype, string $config) { + $blocktypes = blocktypes_lister_types(); + + return $blocktypes[$blocktype][$config] ?? null; +} + /** * Obtenir les saisies d'un block * @@ -143,18 +156,6 @@ function block_get_saisies(int $id_block): array { return $saisies; } -/** - * Obtenir une info de la config d'un block - * - * @param string $blocktype - * @return string|array|null - */ -function blocktype_info(string $config, string $blocktype) { - $blocktypes = blocktypes_lister_types(); - - return $blocktypes[$blocktype][$config] ?? null; -} - /** * Retourner un tableau des valeurs saisies * @@ -177,7 +178,7 @@ function block_get_valeurs(array $saisies, array $valeurs): array { /** * Chercher le squelette correspondant à un block par son identifiant * - * @param string $blocktype Identifiant du type de block + * @param string $blocktype Type de bloc (identifiant) * @param bool $force_public Forcer une recherche du squelette public * @param bool $chemin_complet Retourne le chemin complet du squelette * @param bool $dist Retourne le squelette par défaut (dist)) @@ -266,7 +267,7 @@ function bloctypes_trouver_parents($blocktype): array { /** * Calculer une liste de types de blocks enfants ou parents en fonction du rôle - * @param string $blocktype + * @param string $blocktype Type de bloc (identifiant) * @param string $role * @return array */