Add a CMS Page reference to your model (Dropdown select)
1
Sometimes you may want a reference to a specific CMS Page for filtering purposes.
This can be done with just a few lines of code:
-
add a field to your models database ('cmspage'' in this example)
-
to fields.yaml add:
cmspage:
label: File
type: dropdown
- to YourModel.php add:
public function getCmspageOptions($value, $formData) {
return \Cms\Classes\Page::getNameList();
}
This will save the (base-)filename of the selected page which then can be used for filtering purposes.
There are no comments yet
Be the first one to comment