internal package Foswiki::Configure::Pluggable

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

internal package Foswiki::Configure::Pluggable

A Pluggable is a code module that generates items for a hard-coded block in a configuration, marked by NAME in the .spec.

Pluggables are used for blocks in the configuration that cannot be handled by the configuration abstraction, for example blocks used for downloading extensions, managing plugins, and managing languages.

A pluggable block will normally inject programatically generated configuration entries (subclasses of Foswiki::Configure::Item) into the configuration, usually by appending to the $open configuration item (which will normally be a Foswiki::Configure::Section).

Pluggable implementations are loaded by the parser by calling the load static method in this class. The implementations are packages in Foswiki::Configure::Pluggables, and must provide at least the following function:

StaticMethod construct( \@settings, $file, $line )

Implemented by subclasses to create the pluggable. Pluggables are created in-place, by generating and adding Foswiki::Configure::Item objects and adding them to the settings array.

  • \@settings - ref to the top level array of settings
  • $file, $line - file and line in the .spec that triggered the pluggable

Note that there is no need for constructors to worry about the hierarchical structure of .spec. The structure is only generated after all items have been generated, by analysis of section markers placed in the settings array. So items should be added by simply pushing them into @$settings. However, should a pluggable require a structure within the containing section, it is OK to push new Foswiki::Configure::Section objects to @$settings and populate them using →addChild.

Note also that values added by pluggables should NOT have defined_at set. The presence of this field is used to indicate whether a field was defined explicitly, or in a pluggable.

StaticMethod load($id)

Loads a pluggable section from Foswiki::Configure::Pluggables::$id

Will die if there's a problem.

Returns the result from the Pluggable class's construct

Topic revision: r1 - 21 Nov 2014, ProjectContributor - This page was cached on 18 Oct 2024 - 20:29.

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Irish Doughnut Economics Network? Send feedback