• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Custom Button not getting displayed.

JaXnPriVate

New Pleskian
Server operating system version
Ubuntu
Plesk version and microupdate number
18.0.49
I'm currently Developing an DynDNS Extension for Plesk Obsidian.

Unfortunately, there are some gaps in Plesk's documentation.

I have finished my UI so far but still want to integrate the whole thing as buttons in Plesk.
Do I have to reimport the module to load the hook? I have already disabled and re-enabled the module, but with no success.

PHP:
<?php

namespace hooks;

class DDNSButtons extends \pm_Hook_CustomButtons
{

    public function getButtons()
    {
        // TODO: Implement getButtons() method.
        $buttonsIO = [[
            'place' => self::PLACE_COMMON,
            'title' => 'DynDNS',
            "id" => "ddns-hook-button",
            'description' => 'Dynamic Domain Name System integration.',
            'icon' => pm_Context::getBaseUrl() . 'images/icon.png',
            'link' => pm_Context::getActionUrl('domain'),
        ]];


        return $buttonsIO;
    }
}
 
First, the file needed to be called as "CustomButtons.php"!
Last, the Class need following Name Pattern "Modules_<MODULE NAME>_CustomButtons".

Can you please update your Docs Page with this Information, would be very helpful :p?
 
First, the file needed to be called as "CustomButtons.php"!
Last, the Class need following Name Pattern "Modules_<MODULE NAME>_CustomButtons".

Can you please update your Docs Page with this Information, would be very helpful :p?
This is an incredibly useful peace of information, Plesk Team needs to update the documentation asap.

I'm still not getting it to work though.
How is the <MODULE NAME> put together? Is it the module id from the meta.xml?
Or the module name without whitespaces and camel caps?
 
Ok, I finally managed to get it to work.

<MODULE NAME> = module id (meta.xml) in StudlyCaps.

Example:
<id>my-example-extension</id> from meta.xml
Class name should be: Modules_MyExampleExtension_CustomButtons

Same goes for ContentInclude and other similar files:
Modules_MyExampleExtension_ContentInclude

@To all Plesk employees: Please update the Documentation and the code examples in github with this information.
I'd never get it to work without this post.
 
Back
Top