Documentation

Customization

Redefining logic

The module allows using its own classes instead of preset ones (Bitrix\Rpa\Driver).

This way, module behaviour can be changed.

To do it, subscribe to the event onDriverCollectClasses of rpa module.

Event result retrieves array, where key - class name, and value - its your descendant.

For example, you want to use your own implementation of scenario manager (for example, to add more fields into process draft).

Create own descendant:

class MyDirector extends Bitrix\Rpa\Director 
{
	public function getDraftTypeScenarios(): Bitrix\Rpa\Scenario\Collection
	{
		// MyDraftTypeScenario - your scenario
		return new Bitrix\Rpa\Scenario\Collection([new MyDraftTypeScenario()]);
	}
}

After that, subscribe to event in init.php:

Bitrix\Main\EventManager::getInstance()->addEventHandler(
	'rpa',
	'onDriverCollectClasses', 
	static function(\Bitrix\Main\Event $event) {
		return new \Bitrix\Main\EventResult(\Bitrix\Main\EventResult::SUCCESS, [
			'director' => MyDirector::class,
		]);
	}
);

Now Bitrix\Rpa\Driver::getInstance()->getDirector() returns your class instance.

Classes that can be substituted, inherit their names and classes:

[
    'factory' => Bitrix\Rpa\Factory::class,
    'urlManager' => Bitrix\Rpa\UrlManager::class,
    'director' => Bitrix\Rpa\Director::class,
    'pullManager' => Bitrix\Rpa\Integration\PullManager::class,
    'taskManager' => Bitrix\Rpa\Integration\TaskManager::class,
];

Redefining addresses

One of options to redefine page addresses is to redefine class Bitrix\Rpa\UrlManager.

All methods or their portion can be redefined in own class to get new URL addresses.

Other option - is to specify own custom reference templates.

$templates['bitrix:rpa.panel'] = 'panel/';

\Bitrix\Rpa\Driver::getInstance()->getUrlManager()->saveCustomUrlTemplates($templates);

Now a new address will be opened instead of old address from process list.

By using new address you can insert your own component instead of standard one and to redirect from old address the new address.



© «Bitrix24», 2001-2024