Integrate to Home Page

Extensions can advertise themselves by adding promotional blocks or widgets to the administrator's and customers' Home pages in Plesk. To use this feature, an extension must have a class that extends the pm_Promo_AdminHome class or the pm_Promo_CustomerHome class and overrides the necessary class methods. All classes that extend pm_Promo_AdminHome and pm_Promo_CustomerHome are loaded when users navigate to the Home page. To be successfully displayed, an ancestor class must be properly named. Learn about the naming conventions in Class Naming Conventions.

Example

This example demonstrates an implementation of a promotional block. It uses the following methods:

Use the following code:

<?php
     
class Modules_MyModule_Promo_Home extends pm_Promo_AdminHome
{    
    public function getTitle()
    {
        return 'Add Block Title Here';
    }
     
    public function getText()
    {
        return 'Add your text here...';
    }
     
    public function getButtonText()
    {
        return 'View';
    }
     
    public function getButtonUrl()
    {
        return 'http://example.com';
    }
     
    public function getIconUrl()
    {
        pm_Context::init('my-module');
        return pm_Context::getBaseUrl() . '/images/icon.png';
    }
}

 When you need to use the functions provided by the Extensions API, you need to define context in the method body by calling pm_Context::init('module ID').

The getButtonText and getIconUrl methods are optional. If you omit these methods, Plesk will use the default button caption and icon.

 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.