boite_infos

This pipeline modifies the information block of the objects in SPIP’s private zone. As an example, this is the block that contains the number of an article and the links used to change its status.

It accepts an associative array defined like this:

  • data: what will be displayed on the page,
  • args: another associative array of 3 keys:
    • type: the object type (article, rubrique...)
    • id: the object id (8, 12...)
    • row: array containing all the SQL fields of the object and their values.

Example

The plugin "Prévisualisation pour les articles en cours de rédaction" (previsu_redac) adds the button "Preview" when an article is still in the editing process (normally this link appears only when an article has been submitted for evaluation):

function previsu_redac_boite_infos(&$flux){
    if ($flux['args']['type']=='article'
      AND $id_article=intval($flux['args']['id'])
      AND $statut = $flux['args']['row']['statut']
      AND $statut == 'prepa'
      AND autoriser('previsualiser')){
        $message = _T('previsualiser');
        $h = generer_url_action('redirect', "type=article&id=$id_article&var_mode=preview");
        $previsu =
        icone_horizontale($message, $h, "racine-24.gif", "rien.gif",false);
        if ($p = strpos($flux['data'],'</ul>')){
            while($q = strpos($flux['data'],'</ul>',$p+5)) $p=$q;
            $flux['data'] = substr($flux['data'],0,$p+5) . $previsu . substr($flux['data'], $p+5);
        }
        else
            $flux['data'].= $previsu;
    }
    return $flux;
}

Author Gilles Vincent Published : Updated : 31/05/10

Translations : English, français