Declaring a new pipeline

The pipeline must first be declared in a global options file like this:
$GLOBALS['spip_pipeline']['newPipelineName'] = '';

The name of this pipeline must be a key of the associative array $GLOBALS['spip_pipeline'].

Then, the pipelines must be called from somewhere, either in a template or a PHP file:

  • Templates: #PIPELINE{newPipelineName, initial content}
  • PHP: $data = pipeline("newPipelineName", "initial content");.

The #PIPELINE tag and the pipeline() function both use the same arguments. The first argument is the name (in our example, it’s "newPipelineName"). The other one is the data that is sent to the hook.

The pipeline is a channel by which information is transmitted sequentially. Each plugin that has declared this pipeline is party to this channel, and so can complete or modify the input data, and transmit the result to the next part. The result of the pipeline is the result of the last process that has been applied.

Author Gilles Vincent Published : Updated : 16/02/10

Translations : English, français