Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Page blueprint dropdown list

Started by Muut Archive 10 years ago · 2 replies · 699 views
10 years ago

Hi everybody. I have problem with admin panel setup using blueprints.I have page /planes and its collections. I need to choose on of plane collection by dropdown list on the second page blueprint. How can I do this?

YAML
header.plane_id:
   type: select
   classes: fancy
   label: Plane id
   default: default
   data-options@: '\Grav\Common\Page\Pages::pageTypes'

I think somethig wrong with data-options@. Please help me, I don`t know what to do.

10 years ago

pageTypes only lists the valid support page types avialable in a template. You are going to need to create a static PHP function that lists the pages you want in a plugin so it's loaded and available. Then call that function with data-options@:

TXT
data-options@: `\Grav\Plugins\MyPlugin\MyPlugin::myPageTypes`

Assuming you have a plugin class file in user/plugins/plugins.php called MyPlugin and that has a static function:

TXT
public static function myPageTypes()
{
   ...
}

You can use Pages::pageTypes() as reference.

10 years ago

@rhukster Thanks for answer.I will try it

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1366 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago