[SPIP] Submitted : |picker_selected

SPIP

Article submitted

The article « |picker_selected
(SPIP) » is submitted
for publication. on Monday 26 December 2022.


|picker_selected

Monday 26 December 2022 , by jack

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

  • either on an array of inputs where each value is of the form
    type_objet|id_objet . For example : `

array

(PHP: Arrays - Manual)

(

« rubrique|9 »

,

« article|8 »

)

` .

  • or on a string of the form rubrique|9,article|8,...

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

If given a type argument, the result 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}}

`

— Sent by SPIP (https://www.spip.net/)

rubon199-7e493.jpg