Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saving completely custom page form #1163

Closed
dandob74 opened this issue Jul 17, 2017 · 6 comments
Closed

Saving completely custom page form #1163

dandob74 opened this issue Jul 17, 2017 · 6 comments
Labels

Comments

@dandob74
Copy link

Hi,
saving a custom page (grav doc) within the admin panel leads to the following exception.

Undefined index: folder in user\plugins\admin\classes\admincontroller.php line 464.

image

It looks like commit #d802b97 is the reason for this.

Best and thanks,
Daniel

@BTBTravis
Copy link

BTBTravis commented Jul 17, 2017

I think line 464's conditional needs to check if $data['route'] isset.
I ran into the same problem this morning.

           if (!isset($data['folder'])) {
                $data['folder'] = $obj->slug();
                $this->data['folder'] = $obj->slug();
            }

@rhukster
Copy link
Member

Folder is a required field for the page, so your custom blueprint needs to include it (along with other required elements).

The best approach is to extend default then add your new things, in a new tab, you can even put that tab first if you like.

@flaviocopes
Copy link
Contributor

flaviocopes commented Jul 17, 2017

Looks a recent regression. PR #1164 should fix the problem, can you give it a try?

Actually this is not supposed to work, as per @rhukster comment

@flaviocopes
Copy link
Contributor

You need to extend default, and use unset https://learn.getgrav.org/forms/blueprints/advanced-features#removing-fields-properties-unset to remove fields or tabs you don't want.

@flaviocopes
Copy link
Contributor

Thinking about it again, the documentation example works because it's setting the route parameter explicitly. The problem not extending default is that many useful information is lost, but route is the only mandatory one.

But it stopped working in 1.5.0, fixed in repo.

@ntopulos
Copy link

All my forms stopped working after the update, I came across this issue, but the suggested solution wasn't satisfactory for my needs.

I want my users to be able to edit the content, but I also need to hide from them any advanced tab and field. This is the solution I found; adding the folder input with the type hidden :

        folder:
          type: hidden
          label: PLUGIN_ADMIN.FOLDER_NAME

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants