This pipeline is used to add default content when a new editorial element is being inserted into the database.

When an editorial item is requested to be saved, it has not yet been allocated a unique identifier (implying it is a new item), so an identifier is automatically created for that item using the insert_xx functions, where xx is the name of the intended object. This insertion pipeline has the simple goal of returning an identifier and saving the item’s default values. The pipeline is called from these insert_xx functions.

Once the identifier has been established, the normal modification tasks are performed using the xx_set and modifier_contenu functions which call the pre_edition and post_edition pipelines. Those tasks are the ones that will save the data entered by the user, and which will therefore do so even for new items.

This pipeline passes the table name and an array of fields and default values to be inserted:

$champs = pipeline('pre_insertion',
        'args' => array(
            'table' => 'spip_rubriques',
        'data' => $champs


The "Forum" plugin adds the forum status value for an article when it is created using the code below:

function forum_pre_insertion($flux){
    if ($flux['args']['table']=='spip_articles'){
        $flux['args']['data']['accepter_forum'] =   substr($GLOBALS['meta']['forums_publics'], 0, 3);
    return $flux;

Author Mark Baber Published : Updated : 29/05/10

Translations : English, français