Skip to content

widgets\Menu.php $iconClassPrefix should not be static #169

Open
@CyberPunkCodes

Description

@CyberPunkCodes

Issue:

This doesn't work with the latest FontAwesome v5 icons because a lot of the icons don't start with fa fa-xxx. Some start with fab or fas.

Here are a few examples:

fab fa-accessible-icon
fas fa-align-justify

File: widgets\Menu.php
Line: 31

Currently is:
public static $iconClassPrefix = 'fa fa-';

Should be:
public $iconClassPrefix = 'fa fa-';

Then the corresponding fix on line 84 to this:

: '<i class="' . $this->iconClassPrefix . $item['icon'] . '"></i> ',

Reason:

I am using the latest FontAwesome icons from https://fontawesome.com/icons?d=gallery&m=free loaded via their CDN. So I am not using your built in, out-dated version of FontAwesome.

Implementing this simple fix, would allow us to continue using your plugin along with the latest FontAwesome.

Yes, we would have to set the $iconClassPrefix to '', an empty string, and manually pass the prefixes ourself. Like so:

<?= Menu::widget([
    'options' => ['class' => 'sidebar-menu'],
    'iconClassPrefix' => '',
    'items' => $items,
]) ?>

This would only take a couple minutes to update, until you get the rest of this package updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions