This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

kasperbb9853952
kasperbb9853952

I'm wondering how you would go about getting the options from a balloon selector in the backend, and display those options in any way on the frontend.

EDIT: Some progress -

public function getStatusAttribute() {
    $value = array_get($this->attributes, 'status');
    return array_get($this->getStatusOptions(), $value);
}

public function getStatusOptions() {
 return [
    'Recieved' => 'Recieved',
    'Under Processing' => 'Under Processing',
    'Processed' => 'Processed',
    'Resolved' => 'Resolved'
 ];
}

This works on the frontend, but I'm getting an "Array to string conversion" error when trying to create a model on the backend. Works fine when I just edit, but not when creating.

Last updated

jriley
jriley

If the options are just a static list in a backend form configuration file, you might use the Yaml parser to read them...or the Dynamic Syntax parser to read them and output them as a drop-down menu, as the balloon selector would be defined just like a dropdown field type.

Not sure if I understood your issue exactly so my apologies if that's not what you were asking.

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.