Skip to content

Commit

Permalink
small improvements on docs and passing variant as argument for the fi…
Browse files Browse the repository at this point in the history
…lter callback
  • Loading branch information
Maurits committed Nov 18, 2024
1 parent 16242a8 commit 8541f8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/Services/IconBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ public function buildIcons()
if ($this->variantProp($this->baseVariant, 'source.filter')) {
$files = $files->filter(function($file) {
$icons = &$this->icons;
$res = call_user_func_array($this->variantProp($this->baseVariant, 'source.filter'),[
$file,
&$icons
]);
$res = call_user_func_array(
$this->variantProp($this->baseVariant, 'source.filter'),
[$file, &$icons, $this->baseVariant]
);
return $res;
});
}
Expand Down Expand Up @@ -549,7 +549,7 @@ public function getVariantIconFile(string $variant, string $basename, Icon $icon
$icons = $this->icons;
if(!call_user_func_array(
$filter,
[$file, &$icons]
[$file, &$icons, $variant]
)){
$file = null;
}
Expand Down
13 changes: 8 additions & 5 deletions src/Services/Vendors/Mdi.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
class Mdi
{
/**
*
* Filter function to determine if the icon is an outline icon
* @param string $file
* @param array|null $icons
* @param string $variant the variant of the source icon (outline, solid, mini, micro)
* @return boolean
*/
public static function outlineFilter($file, &$icons): bool
public static function outlineFilter($file, &$icons, $variant): bool
{
if($icons === null){
$icons = [];
Expand All @@ -38,11 +39,13 @@ public static function outlineFilter($file, &$icons): bool
}

/**
*
* @param $size size of the resource icon
* Filter function to determine if the icon is a solid icon
* @param string $file
* @param array|null $icons
* @param string $variant the variant of the source icon (outline, solid, mini, micro)
* @return boolean
*/
public static function solidFilter($file, &$icons): bool
public static function solidFilter($file, &$icons, $variant): bool
{
$filename = pathinfo($file, PATHINFO_FILENAME);
if (Str::contains($filename,'-outline')) {
Expand Down

0 comments on commit 8541f8e

Please sign in to comment.