Customize MadeToPrint Enterprise Server Plugin
One of the advantages of the new MadeToPrint Enterprise Server Plugin is its customizability. This can be achieved by a custom Enterprise Plugin.
To customize the MadeToPrint Enterprise Server Plugin, it does contain code where you can hook into the processing and change specific settings, processing, etc.
Sample customization
To do so, follow the instructions of this sample customization that will customize the comment that MadeToPrint is creating after processing a layout.
- Create a folder, say 'AxaioMadeToPrintCustomizationComment' in config/plugins (make sure that the web user can write into this folder).
- Login to Enterprise and visit the server plugin page.
The corresponding files will be generated:- config.php (optional)
- LICENSE (optional)
- NOTICE (optional)
- PluginInfo.php (required)
- Adjust the PluginInfo.php file. It might look like
<?php
require_once BASEDIR.'/server/interfaces/plugins/EnterprisePlugin.class.php';
class AxaioMadeToPrintCustomizationFilterFullrow_EnterprisePlugin extends EnterprisePlugin
{
public function getPluginInfo()
{
require_once BASEDIR.'/server/interfaces/plugins/PluginInfoData.class.php';
$info = new PluginInfoData();
$info->DisplayName = 'Axaio MadeToPrint comment customization';
$info->Version = '10.9 0'; // don't use PRODUCTVERSION
$info->Description = 'For demo purposes - filter comment';
$info->Copyright = 'axaio software GmbH. All Rights Reserved.';
return $info;
}
final public function getConnectorInterfaces()
{
return array(
'AxaioMadeToPrintDispatcher_EnterpriseConnector',
);
}
}
- Create another file which has this naming convention:
<folderName>_AxaioMadeToPrintDispatcher.class.php
So, for this test case, the folder name is ‘AxaioMadeToPrintCustomizationComment’, so your file will become AxaioMadeToPrintCustomizationComment_AxaioMadeToPrintDispatcher.class.php
The file should look like below:
<?php declare( strict_types = 1 );
/**
* @since 10.9.x
* @copyright WoodWing Software bv. All Rights Reserved.
* @copyright axaio software GmbH. All Rights Reserved.
*/
require_once BASEDIR.'/server/plugins/AxaioMadeToPrint/interfaces/plugins/connectors/AxaioMadeToPrintDispatcher_EnterpriseConnector.class.php';
class AxaioMadeToPrintCustomizationComment_AxaioMadeToPrintDispatcher extends AxaioMadeToPrintDispatcher_EnterpriseConnector
{
// your customize functions go here
}
Make sure the above is matches the script name (without .class.php)
- Next, you can start adding your custom code. You can see your overruling options by have a look into the file AxaioMadeToPrint/interfaces/plugins/connectors/AxaioMadeToPrintDispatcher_EnterpriseConnector.class.php or by finding the equivalent hook in the source code of the server plugin. The one we are looking for is
self::runCustomization()->postProcessFilterComment
. - Copy over this function from the file just mentioned (AxaioMadeToPrintDispatcher_EnterpriseConnector.class.php) to your this new file called AxaioMadeToPrintCustomizationComment_AxaioMadeToPrintDispatcher.class.php
- You'll start with
public function postProcessFilterComment( string &$comment, string $layoutId, string $layStatusId, string $layEditionId, int $success, array &$mtpConfig, array $commentInfo ): void
{
// your custom code here
}
- Those parameters having an ampersand
&
can be altered. In this sample, we want to change the comment depending on the success status of the MadeToPrint process.
if( $success == 1) {
$comment = 'OK';
} else {
$comment = 'Job contained error: ' . $commentInfo['message'];
}
That's it. Once you enable this custom plugin in the Enterprise Server plugin page, the function will be called each time the process starts.
You can also run multiple customizations, all in one plugin, or in separate plugins that can be activated / deactivated separately.
0 Comments
Add your comment