Grav-plugin-admin: Page select for a particular page type

Created on 5 Nov 2016  ·  7Comments  ·  Source: getgrav/grav-plugin-admin

Is there a way in which I can have a page select that either only allows the user to select items of a particular type or from a path?

enhancement

Most helpful comment

I was asking for something similar. Often you only want to provide the user a list of subpages (portfolio sub pages etc.)
https://getgrav.org/forum#!/general:forms-the-pages-field-s

All 7 comments

Not yet. Marking as enhancement

I was asking for something similar. Often you only want to provide the user a list of subpages (portfolio sub pages etc.)
https://getgrav.org/forum#!/general:forms-the-pages-field-s

What is status of this issue ?

I'm looking for a way to filter page select options by page type.

I am also looking for a way to do this. Basically I want to add a Button to the Admin interface that allows the User to more quickly add a child to a certain page.

Let's say I have a structure like this:

  |--about
  |--links
  |--works
      |--programming
      |     |--foo.rs
      |     |--bar.py
      |
      |--painting
      |     |--amazing_new_painting
      |     |--a_boring_landscape_painting
      |
      |--yodeling
            |--i_am_still_a_beginner

I want the user to get a dialogue where they only have to select from a list of programming, painting, yodeling and enter a title for the work, without the need to think about templates, parents, etc. This is quite important, because I don't think users should have to remember these templates for a page they might update 4 times a year..

I know how to add a _"Add Work"_ Button with a fixed route, but not how to dynamically list the children of _works_ for a field with type: select.

I think you might be looking for: https://learn.getgrav.org/forms/blueprints/advanced-features#using-function-calls-data ?

I think you might be looking for: https://learn.getgrav.org/forms/blueprints/advanced-features#using-function-calls-data ?

@rhukster: Testing at the moment with Grav v1.6.25 & Admin v1.9.14, data-options@ when using the route name with a blueprint like:

form:
    route:
      type: selectize
      label: Route
      selectize:
        data-options@: '\Grav\Theme\MyTheme::selectizeSomePages'

causes the frontend script to break with this Error in JS:

TypeError: i is undefined

i being slug, it seems like it’s coming from this exception: https://github.com/getgrav/grav-plugin-admin/blob/9c7868fd3a254b98bdbe0bde21988cc18338186e/themes/grav/app/forms/fields/selectize.js#L39

This is the case for types parents, select, selectize and selectunique, at least.

I understand this problem as related to #1814.

(Same with Grav and plugins up to date.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amadeusp picture amadeusp  ·  3Comments

darkroastcreative picture darkroastcreative  ·  4Comments

illycz picture illycz  ·  5Comments

ritchiedalto picture ritchiedalto  ·  6Comments

fourroses666 picture fourroses666  ·  4Comments