Multiselect Type

Overview

The multiselect field type stores an array of selections from a list of options. The multiselect field type also supports callable options.

// streams/users.json
"fields": {
    "picks": {
        "type": "multiselect",
        "config": {
            "options": {
                "star": "Star",
                "circle": "Circle",
                "umbrella": "Umbrella",
                "triangle": "Triangle"
            }
        }
    }
}

Callable Options

Besides basic array and associated arrays, you may specify a callable string:

{
    "type": "multiselect",
    "config": {
        "options": "\\App\\[email protected]"
    }
}

The $type can be injected in order aid in returning options:

// app/CustomOptions.php
class CustomOptions
{
    public function handle($type)
    {
        return [
            'foo' => 'Foo',
            'bar' => 'Bar',
        ];
    }
}

Data Structure

{
    "picks": ["circle", "triangle"]
}

Basic value access displays the stored key value:

// Basic access
[{{ implode(', ', $entry->picks) }}]

Decorator Usage

Multiselect types also provide decorated values.

// Decorated value
[{{ implode(',' $entry->picks()->values()) }}]

Methods

@todo Generate methods from @docs

Configuration

@todo Generate config options from class::configuration