class HelpTopicDiscovery implements DiscoveryInterface (View source)

internal  Help Topics is currently experimental and should only be leveraged by experimental modules and development releases of contributed modules. See https://www.drupal.org/core/experimental for more information.
 

Discovers help topic plugins from Twig files in help_topics directories.

Traits

Constants

FILE_KEY

Defines the key in the discovered data where the file path is stored.

Properties

protected array $directories

An array of directories to scan, keyed by the provider.

Methods

array
getDefinitions()

Gets the definition of all plugins for this type.

getDefinition($plugin_id, $exception_on_invalid = TRUE)

{@inheritdoc}

array|null
doGetDefinition(array $definitions, string $plugin_id, bool $exception_on_invalid)

Gets a specific plugin definition.

hasDefinition($plugin_id)

{@inheritdoc}

__construct(array $directories)

Constructs a HelpTopicDiscovery object.

array
findAll()

Returns an array of discoverable items.

array
findFiles()

Returns an array of providers keyed by file path.

Details

array getDefinitions()

Gets the definition of all plugins for this type.

Return Value

array

An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

getDefinition($plugin_id, $exception_on_invalid = TRUE)

{@inheritdoc}

Parameters

$plugin_id
$exception_on_invalid

protected array|null doGetDefinition(array $definitions, string $plugin_id, bool $exception_on_invalid)

Gets a specific plugin definition.

Parameters

array $definitions

An array of the available plugin definitions.

string $plugin_id

A plugin id.

bool $exception_on_invalid

If TRUE, an invalid plugin ID will cause an exception to be thrown; if FALSE, NULL will be returned.

Return Value

array|null

A plugin definition, or NULL if the plugin ID is invalid and $exception_on_invalid is TRUE.

Exceptions

PluginNotFoundException

hasDefinition($plugin_id)

{@inheritdoc}

Parameters

$plugin_id

__construct(array $directories)

Constructs a HelpTopicDiscovery object.

Parameters

array $directories

An array of directories to scan, keyed by the provider. The value can either be a string or an array of strings. The string values should be the path of a directory to scan.

array findAll()

Returns an array of discoverable items.

Return Value

array

An array of discovered data keyed by provider.

Exceptions

DiscoveryException

protected array findFiles()

Returns an array of providers keyed by file path.

Return Value

array

An array of providers keyed by file path.