|picker_selected

This filter, initially proposed by the Bonux plugin and then integrated into the core with SPIP 3.0.17, applies to :

  • either an array of inputs where each value is of the form type_objet|id_objet . For example : array("rubrique|9", "article|8").
  • or a string of the form rubrique|9,article|8,...

It returns an array of couples (objet => id_objet).

If given a type argument, the resulting array is restricted to objects of that type.

Examples

After #SET{liste, #LISTE{article|1,article|2,rubrique|5}}

[(#GET{liste}|picker_selected)] returns the array array('article' => 1, 'article' => 2, 'rubrique' => 5)

and [(#GET{liste}|picker_selected{article})] returns the array array('article' => 1, 'article' => 2) which contains only articles.

Use

The format rubrique|9,article|8,... is that provided by generic selector entries.

Example : If in a plugin, the configuration form proposes a section selector named "home", we can recover the selection in the template with:
{id_rubrique IN #CONFIG{myplugin/home}|picker_selected{rubrique}}

Author jack Published : Updated : 29/12/22

Translations : English, français