About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
development:plugins:channel_providers

Channel Providers

Channel providers are used to generate lists of records related to a particular search or other record. Their configuration is described on the Channels page.

Key Plugin Details

Default Namespace: \VuFind\ChannelProvider

Interface: \VuFind\ChannelProvider\ChannelProviderInterface

Base Class: \VuFind\ChannelProvider\AbstractChannelProvider

Service Locator Configuration Section in module.config.php: ['vufind']['plugin_managers']['channelprovider']

Service Manager Name for Service Locator: VuFind\ChannelProviderPluginManager (VuFind 2.x-4.x), VuFind\ChannelProvider\PluginManager (VuFind 5.0+)

See the General Plugin Information page for more details on VuFind plugins.

Basic Structure

Each channel provider must implement the ChannelProviderInterface. An AbstractChannelProvider is available which provides useful default functionality to cover most of the non-channel-specific details.

Setup Methods

The interface requires a setOptions method to accept configuration values from channels.ini, and a setProviderId method to accept a unique identifier for the current channel provider.

Hooks

The interface defines a configureSearchParams method which is used as a hook to configure a VuFind search parameters object prior to executing a search when channels are being generated from a user search. This hook is not used when channels are generated from a record. The AbstractChannelProvider provides an empty implemention, so this method can be ignored when it is not needed if subclassing the AbstractChannelProvider.

Channel Providing Methods

getFromRecord provides channel information related to a record driver. getFromSearch provides channel information related to a VuFind search results object.

Each of these methods returns an array of arrays representing channels. Some channels may be fully populated with record information. Other channels may include token values which allow more details to be retrieved later. The token mechanism is necessary to allow a large number of channels to be generated without taking up too much time retrieving full details all at once.

Both of these methods have an optional second parameter called $channelToken. This can accept one of the token values described above; if the token is omitted, information about all possible channels is returned. The value of the token is arbitrary – the channel provider both produces and consumes token values, and it can use anything it needs to in order to allow fetching of specific channel information.

development/plugins/channel_providers.txt · Last modified: 2020/09/22 14:13 by demiankatz