Skip to content

Latest commit

 

History

History
193 lines (172 loc) · 10.8 KB

File metadata and controls

193 lines (172 loc) · 10.8 KB

BumbleDocGen / Technical description of the project / Plugin system


Plugin system

The documentation generator includes the ability to expand the functionality using plugins that allow you to add the necessary functionality to the system without changing its core.

The system is built on the basis of an event model, each plugin class must implement PluginInterface.

Configuration example

You can add your plugins to the configuration like this:

plugins:
  - class: \SelfDocConfig\Plugin\RoaveStubber\BetterReflectionStubberPlugin
  - class: \SelfDocConfig\Plugin\TwigFilterClassParser\TwigFilterClassParserPlugin
  - class: \SelfDocConfig\Plugin\TwigFunctionClassParser\TwigFunctionClassParserPlugin

Default plugins

Below are the plugins that are available by default when working with the library. Plugins for any programming languages work regardless of which language handler is configured in the configuration.

Plugin PL Handles events Description
LastPageCommitter any Plugin for adding a block with information about the last commit and date of page update to the generated document
PageHtmlLinkerPlugin any Adds URLs to empty links in HTML format; Links may contain: 1) Short entity name 2) Full entity name 3) Relative link to the entity file from the root directory of the project 4) Page title ( title ) 5) Template key ( BreadcrumbsHelper::getTemplateLinkKey() ) 6) Relative reference to the entity document from the root directory of the documentation
PageLinkerPlugin any Adds URLs to empty links in HTML format; Links may contain: 1) Short entity name 2) Full entity name 3) Relative link to the entity file from the root directory of the project 4) Page title ( title ) 5) Template key ( BreadcrumbsHelper::getTemplateLinkKey() ) 6) Relative reference to the entity document from the root directory of the documentation
PageRstLinkerPlugin any Adds URLs to empty links in rst format; Links may contain: 1) Short entity name 2) Full entity name 3) Relative link to the entity file from the root directory of the project 4) Page title ( title ) 5) Template key ( BreadcrumbsHelper::getTemplateLinkKey() ) 6) Relative reference to the entity document from the root directory of the documentation
BasePhpStubberPlugin PHP Adding links to type documentation and documentation of built-in PHP classes
PhpDocumentorStubberPlugin PHP Adding links to the documentation of PHP classes in the \phpDocumentor namespace
PhpUnitStubberPlugin PHP Adding links to the documentation of PHP classes in the \PHPUnit namespace
StubberPlugin PHP The plugin allows you to automatically provide links to github repositories for documented classes from libraries included in composer
EntityDocUnifiedPlacePlugin PHP This plugin changes the algorithm for saving entity documents. The standard system stores each file in a directory next to the file where it was requested. This behavior changes and all documents are saved in a separate directory structure, so they are not duplicated.

Default events

Adding a new plugin

If you decide to add a new plugin, there are a few things you need to do:

1) Add plugin class and implement events handling

namespace Demo\Plugin\DemoFakeResourceLinkPlugin;

final class DemoFakeResourceLinkPlugin implements \BumbleDocGen\Core\Plugin\PluginInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            \BumbleDocGen\Core\Plugin\Event\Renderer\OnGettingResourceLink::class => 'onGettingResourceLink',
        ];
    }

    public function onGettingResourceLink(OnGettingResourceLink $event): void
    {
        if (!$event->getResourceUrl()) {
            $event->setResourceUrl("https://google.com");
        }
    }
}

2) Add the new plugin to the configuration

plugins:
  - class: \Demo\Plugin\DemoFakeResourceLinkPlugin\DemoFakeResourceLinkPlugin

Last page committer: fshcherbanich <filipp.shcherbanich@team.bumble.com>
Last modified date: Sat Oct 28 11:03:31 2023 +0300
Page content update date: Mon Nov 06 2023
Made with Bumble Documentation Generator