Voyager: Documentation for Dropdown

Created on 5 Nov 2017  路  10Comments  路  Source: the-control-group/voyager

  • Laravel Version: Irrelevant

  • Voyager Version: 0.11

  • PHP Version: Irrelevant
  • Database Driver & Version: Irrelevant

Description:

Broken Version

Docs claim that dropdowns are setup like:

{
    "default": "",
    "options": {
        "m": "Male",
        "f": "Female"
    }
}

Notice the word options [sic].

Fixed Version

It should be option - notice the _missing letter s_:

{
    "default": "",
    "option": {
        "m": "Male",
        "f": "Female"
    }
}

Steps To Reproduce:

  1. Make a dropdown field called "gender" or whatever;
  2. Insert the first one or even just copy/paste from the docs;
  3. Watch the horrid exception;
  4. Remove the 's';
  5. Watch everything work.
documentation possible bug stale

Most helpful comment

More information - on the edit view, no dropdown is created when the word option (no s) is used, so @fletch3555:

  1. The column/list view (the thing that just a plain slug goes to) has the issue;
  2. The code "ignores" a JSON option option in the edit view and renders it as an empty relation

All 10 comments

Why should it be option? Looking at the code (both the tagged v0.11.14 and master branch.. see links below), it's looking for options with the 's'.

v0.11.14: https://github.com/the-control-group/voyager/blob/v0.11.14/resources/views/formfields/select_dropdown.blade.php#L18
master: https://github.com/the-control-group/voyager/blob/master/resources/views/formfields/select_dropdown.blade.php#L18

(2/2) ErrorException

Undefined property: stdClass::$ (View: C:\laragon\webroots\playhq\attendence-laravel\vendor\tcg\voyager\resources\views\bread\browse.blade.php)

image

I agree - options should work but it's not (at least for me).

@fletch3555 - all I know is that changing it from options to just option fixes it all.

This might be an issue but I don't see how this would affect it.

BreadRelationshipParser.zip

More information - on the edit view, no dropdown is created when the word option (no s) is used, so @fletch3555:

  1. The column/list view (the thing that just a plain slug goes to) has the issue;
  2. The code "ignores" a JSON option option in the edit view and renders it as an empty relation

Yeah, seems options is perfectly correct, but is manifesting as the problem, hiding the real problem. This is going to take a bit more digging to figure out. I haven't had much time lately, and haven't been able to reproduce it locally, so if someone else can, please feel free to take lead on troubleshooting

Just wanted to comment that I have the same issue. Using options:

Undefined property: stdClass::$Lobby (View: /var/www/zoomrec/vendor/tcg/voyager/resources/views/bread/browse.blade.php)

Changing to option results in the same bug as described by @lloy0076 above with no dropdown generated when editing.

Is this still a problem?
Looking at the code options is the correct key.

Why should it be option? Looking at the code (both the tagged v0.11.14 and master branch.. see links below), it's looking for options with the 's'.

v0.11.14: https://github.com/the-control-group/voyager/blob/v0.11.14/resources/views/formfields/select_dropdown.blade.php#L18
master: https://github.com/the-control-group/voyager/blob/master/resources/views/formfields/select_dropdown.blade.php#L18

link broken

Likely because 0.11.14 was released like 2+ years ago and we pruned away most of the pre-1.0 tags. You're quoting a comment from 2.5+ years ago, and related to a MUCH older version, so it's not likely to be relevant anyway

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TXRRNT picture TXRRNT  路  3Comments

IvanBohonosiuk picture IvanBohonosiuk  路  4Comments

TPRAsh picture TPRAsh  路  3Comments

duongsieu picture duongsieu  路  3Comments

MikadoInfo picture MikadoInfo  路  3Comments