Plesk Home Page Widgets

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 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.

Usage Example

The following code demonstrates an implementation of a promotional block.

<?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 comments on this page

Leave your feedback or question on this documentation topic below. For technical assistance, contact your hosting service provider or submit a request to Plesk support. Suggest new features for Plesk here. Discuss general questions on the Plesk forum. All offtopic comments will be removed.