Skip to content
Extraits de code Groupes Projets
Valider 33e13e4e rédigé par nicod's avatar nicod
Parcourir les fichiers

chore: Renommage

On reçoit le nom de l'icone à chercher, pas un blocktype
parent c1b02e36
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -155,20 +155,20 @@ function blocktypes_lister_types(bool $exclure_ignores = true): array {
}
/**
* Retrouver l'icone d'un blocktype, la réduire à 16 px
* Retrouver l'icone d'un blocktype
*
* @param string $blocktype Type de block (identifiant)
* @param string $icone Nom du fichier
* @return string chemin
**/
function _blocktype_find_icone_path(string $blocktype): string {
function _blocktype_find_icone_path(string $icone): string {
static $cache;
if (isset($cache[$blocktype])) {
return $cache[$blocktype];
if (isset($cache[$icone])) {
return $cache[$icone];
}
if (!$chemin = find_in_path("blocks/$blocktype")) {
if (!$chemin = find_in_path("icones/$blocktype")) {
if (!$chemin = find_in_theme("images/$blocktype")) {
if (!$chemin = find_in_path($blocktype)) {
if (!$chemin = find_in_path("blocks/$icone")) {
if (!$chemin = find_in_path("icones/$icone")) {
if (!$chemin = find_in_theme("images/$icone")) {
if (!$chemin = find_in_path($icone)) {
$chemin = '';
}
}
......@@ -176,11 +176,11 @@ function _blocktype_find_icone_path(string $blocktype): string {
}
include_spip('inc/filtres');
include_spip('inc/filtres_images_mini');
//Au cas où find_in_theme nous return un truc genre gis-xx.svg?16px
// Au cas où find_in_theme nous return un truc genre identifiant-xx.svg?16px
$chemin = preg_replace('#\?.*$#', '', $chemin);
//On force la reduction à 16px
// On force la reduction à 16px
//$chemin = extraire_attribut(image_reduire($chemin, 16), 'src');
$cache[$blocktype] = $chemin;
$cache[$icone] = $chemin;
return $chemin;
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter