Add Small Buttons

Small buttons look exactly the same as the tools of the list. So, if we want to add a toolbar above a table, we need to use setTools. But sometimes you may need to add a toolbar without the table itself when implementing your extension's UI. The overview page of an object featuring a toolbar with an "Edit" button is an example of such a scenario.

To add a small button to a page, you need to define it in the controller:

public function smallButtonsAction()
{
	$this->view->smallTools = [
		[
			'title' => 'Button 1', 
			'description' => 'Example of link to controller and action', 
			'class' => 'sb-button1', 
			'controller' => 'custom', 
			'action' => 'form', 
		], 
		[
			'title' => 'Button 2', 
			'description' => 'Link to extension entry point', 
			'class' => 'sb-button2', 
			'link' => pm_Context::getBaseUrl() , 
		], 
	];
}

Then render it in view (small-buttons.phtml) using the pm_View_Helper_RenderSmallTools helper:

<?php echo $this->renderSmallTools($this->smallTools); ?>

Now you can visit the small-buttons action of your extension and check the result. Moreover, you can see what the button would look like on a Plesk server using a different color scheme or branding (for example, when the Skins and Color Schemes extension is installed), or what the button would look like in adaptive design on a mobile device.

 

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.