Jump to content

How can i change attached files label?


Recommended Posts

I'm looking to change the attached files label on the client side. at the moment i've got this code from the "editing panel" section.

 

<?php
 
// This hook will adjust the button in the home page panels. You have two
// different options of setExtra() or setExtras(). Use of setExtras() requires
// passing all 'extra' related vars through the array.
 
use WHMCS\View\Menu\Item;
 
add_hook('ClientAreaHomepagePanels', 1, function (Item $homePagePanels) {
    $YourFiles = $homePagePanels->getChild('Your Files');
     
    if (!is_null($YourFiles)) {
        $YourFiles->setExtras(
            [
                'color' => 'asbestos',
            ]
        );
    }
});

What am i missing? its not changing anything unless i have that button bit included :(

Link to comment
Share on other sites

29 minutes ago, monsterit said:

What am i missing? its not changing anything unless i have that button bit included

if all you want to do is change the label on the panel, then you have a couple of options...

  1. if it's a default homepage panel (e.g one that you haven't created yourself), then it will (should!) use a Language string for the label - if so, then you can change it using a Language Override.
    $_LANG['clientareafiles'] = "Attached Files by Monster IT";

    kkXiRr9.png
    bear in mind, that you'll have to add language overrides for every language that you want to change the label for.

  2. you could use a hook to change the label of a panel and hard-code the label to be the same for all users....

    <?php
    
    use WHMCS\View\Menu\Item as MenuItem;
    
    add_hook('ClientAreaHomepagePanels', 1, function(MenuItem $homePagePanels)
    {
    	if(!is_null($homePagePanels->getChild('Your Files'))){
    		$homePagePanels->getChild('Your Files')
    				->setLabel('Attached Files by brian!');
    	}
    });

    gewnG8L.png
    the hook label changes would take precedence over any language override.

  3. there is a third way in which you could use the above hook to utilise a language string for the label - but in this instance, if you want to do that, you might as well just change the existing language strings with overrides. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated