dragomano / Light-Portal

A fancy portal mod for SMF 2.1.x
https://custom.simplemachines.org/index.php?mod=4244
GNU General Public License v3.0
16 stars 3 forks source link

A different label for menu #81

Closed Darknico closed 2 years ago

Darknico commented 2 years ago

Is your feature request related to a problem? Please describe. (Опишите, зачем вам эта фича) No, it only is a suggestion

Describe the solution you'd like (Опишите желаемое решение) The possibility to change the label for Portal and Forum immagine not by translation, but by setting in admin area, because each mod update, replace all customization for these labels

dragomano commented 2 years ago

I decided it was easier to implement this feature into an existing plugin than to add new options to the mod itself :)

Darknico commented 2 years ago

It is a good idea, I tested and work correclty :) Only a little suggestion:

immagine

In the navigation, use the old label

dragomano commented 2 years ago

Should the new label be displayed there too?

Darknico commented 2 years ago

For me, yes, it is more correct. The frontpage now I rename in "Home".

Does it make sense to you?

dragomano commented 2 years ago

Ok, add this code to MainMenu.php:

    public function frontCustomTemplate()
    {
        if (! empty($this->context['lp_main_menu_addon_portal_langs'][$this->user_info['language']]) && ! empty($this->context['linktree'][1]))
            $this->context['linktree'][1]['name'] = $this->context['lp_main_menu_addon_portal_langs'][$this->user_info['language']];
    }
Darknico commented 2 years ago

Missing in the init the hook :) add_integration_function('integrate_menu_buttons', __CLASS__ . '::frontCustomTemplate#', false, __FILE__);

work correctly immagine

dragomano commented 2 years ago

It is a portal hook, you shouldn't add it via add_integration_function. It is enough to add a hook name in the plugin file.

Darknico commented 2 years ago

Sorry, I didn't understand where to add it. I'm not very experienced with hooks (and php knowledge is basic)

only add this function, not work