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',
array(
'args' => array(
'table' => 'spip_rubriques',
),
'data' => $champs
)
);