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

limit fields that are shown when embedding editing #81

Open
dbu opened this issue Jul 30, 2013 · 10 comments
Open

limit fields that are shown when embedding editing #81

dbu opened this issue Jul 30, 2013 · 10 comments

Comments

@dbu
Copy link
Member

dbu commented Jul 30, 2013

this looks pretty bad (the current sandbox is still the same):
http://cmf.liip.ch/de/admin/bundle/content/multilangstaticcontent/cms/content/demo/edit

is there a way we can not have the admin extension trigger when embedding? i guess that is up to the extension itself to figure it out - should we adjust it? i guess we should also hide the name as its not editable anyways.

according to thomas rabaix, the proper way to know if an admin is embedded is to check getParentFieldDescription for null. if i add this to the publish workflow extensions, it gets a lot better:

    if (null !== $formMapper->getAdmin()->getParentFieldDescription()) {
        return;
    }

shall we do that? do we have to make this configurable?

Another option is to have a less compact view ith sonata_type_collection disable the two lines

                    'edit' => 'inline',
                    'inline' => 'table',

which makes the items show as in the stand alone editing with one row per field. that is more usable then what we end up here. however, the layout then still could use a lot of tweaking.

@dantleech
Copy link
Member

What if one of the extension form fields is required in the model?

@dantleech
Copy link
Member

Maybe the best would be to provide a specific form builder for the embeded form that will be used in preference if it exists.

protected function confirgureEmbeddedFormFields(FormMapper $formMapper)
{
...
}

@dbu
Copy link
Member Author

dbu commented Jul 31, 2013

What if one of the extension form fields is required in the model?

this could be a problem when creating new items, indeed. editing
existing documents is ok, you just can't change those fields then which
is fine. in that case, we could provide defaults in the alterNewInstance
but this gets quite hairy.

@dbu
Copy link
Member Author

dbu commented Jul 31, 2013

that would add yet another method to admin and admin extensions, not
sure if thomas would be happy about that. i think a method
isEmbeddedAdmin instead of the unobvious check for the parent name
should be clean enough. but that is a general sonata topic out of scope
for this issue.

@sjopet
Copy link
Member

sjopet commented Jul 31, 2013

        $adminAttributes = $formMapper->getFormBuilder()->getAttribute('sonata_admin');
        $editInline = isset($adminAttributes['edit']) && $adminAttributes['edit'] == 'inline';

That's a way to check if inline editing is enabled maybe not entirely relevant for this issue though.
maybe you should add the required fields always and some optional fields only when it's not an embedded form. Is it likely people are going to add pwf stuff on the menu item in an embedded form?.

@dbu
Copy link
Member Author

dbu commented Jul 31, 2013

@sjopet the problem is that if you enable pwf by interface, it will
always trigger, also on embedded. in this case it does not matter how we
attach the pwf, as the same admin is used to embed and to show menu
entries stand alone.

@sjopet
Copy link
Member

sjopet commented Jul 31, 2013

@dbu but you could still differentiate between when an admin is embedded or not and adjust the number of fields that are displayed.

@rande
Copy link

rande commented Jul 31, 2013

I don't get the issue here, can you be more specific ?

@dbu is right about the workflow. The extension has to figure if the current admin is embed or not.

@dbu
Copy link
Member Author

dbu commented Jul 31, 2013

@rande when editing embedded menu items with https://github.com/symfony-cmf/MenuBundle/blob/master/Admin/Extension/MenuNodeReferrersExtension.php (edit inline, table) and having other extensions activated on the MenuAdmin, the table rows get awfully squeezed together. you can look at http://cmf.liip.ch/de/admin/bundle/content/multilangstaticcontent/cms/content/demo/edit (login is admin/admin) to see what happens.

we try to figure out what would be the right thing to do

@dbu
Copy link
Member Author

dbu commented Sep 2, 2013

@rande is there a way to control the layout of an embedded admin? can it be multiline? or have some sort of horizontal tabs?

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

No branches or pull requests

6 participants