verbb / cp-nav

Control Panel Nav is a Craft CMS plugin to help manage your Control Panel navigation.
MIT License
130 stars 11 forks source link

Cp clear cache and error #115

Closed wmdhosting closed 1 year ago

wmdhosting commented 1 year ago

Describe the bug

CP clear cache plugin icon not visible when cp is activated.. https://github.com/mmikkel/CpClearCache-Craft

tryed on upgrade craft and fresh install

and this error showing. verbb\cpnav\models\Navigation::getBadgeCount(): Return value must be of type int, string returned - /home/craft4wmd/vendor/verbb/cp-nav/src/models/Navigation.php: 155.

That worked well on craft 3

Steps to reproduce

  1. install https://github.com/mmikkel/CpClearCache-Craft
  2. instal cp nav

Craft CMS version

4.3 4.2.8

Plugin version

4.0.6

Multi-site?

y

Additional context

No response

wmdhosting commented 1 year ago

found one more. thing

plugins dont show in sublevel.. Snag_113b379b

engram-design commented 1 year ago

This would be down to how the CpClearCache is registering its nav items. They currently use an event:

Event::on(Cp::class, Cp::EVENT_REGISTER_CP_NAV_ITEMS, function (RegisterCpNavItemsEvent $event) {
    $event->navItems['mmikkel/cpclearcache'] = [
        'label' => \Craft::t('app', 'Clear Caches'),
        'fontIcon' => 'trash',
        'url' => 'mmikkel/cpclearcache'
    ];
});

Instead of a function:

public function getCpNavItem(): ?array
{
    ...
}

Should be fixed, along with the plugin subnav issue in 4.0.7