Comments (5)
it would totally make sense to have an edit interface for a whole menu.
in fact, making the root nodes a special menu node (maybe simply extend the normal menu node document?) is the easiest way to achieve that with sonata admin. then besides the infos on the root menu node, we can simply show the subtree and the user can click to edit in an overlay, drag + drop to move and right-click to add nodes. something along
if($this->sonataAdminMode !== $this::CREATE_MODE){
// only render children when in edit mode (overlay needs existing parent id)
$formMapper
->with('Menu')
->add('children', 'doctrine_phpcr_odm_tree_manager', array('mapped' => false, 'root' => $this->getSubject()->getPath()))
->end();
}
(not sure if this is even documented anywhere already)
i think it make sense to allow the menu root nodes to be MenuNodes themselves (see our discussion in #15)
from menu-bundle.
Yeah I agree, so if we make a root menu node, called simply Menu
, that extends the MenuNode
and then the admin interface as you suggest.
Will be a chunk of work, but I think I will tag it provisionally 1.0.
from menu-bundle.
yep, sounds good. its kind of "nice to have" for 1.0 but would be nice
indeed.
from menu-bundle.
Closing this as there is a PR, although looking at your suggestion now I have a few questions:
- Is "mapped" a real option? (it works without that)
- sonataAdminMode doesn't exist, I am using the presence of an ID to determine if we are in edit mode - do you know a better way?
from menu-bundle.
the mapped = false
is to avoid the form layer trying to do anything with that field as the changes to the tree are handled in overlays
the CREATE_MODE was a thing from the controller where i copied the example, sorry. we did this to know if we create a new object or edit an existing:
$this->sonataAdminMode = $this->getSubject()->getPath() ? $this::EDIT_MODE : $this::CREATE_MODE;
from menu-bundle.
Related Issues (20)
- bug in QuietFactory HOT 3
- [Release Request] New release to add knp menu ^2.0 HOT 2
- Confused about changes to AbstractMenuNodeAdmin HOT 2
- KnpMenuBundle menu renderer throws an exception if it is used together with MenuBundle HOT 5
- MenuBundle disable all the knp menu extensions HOT 12
- Update docs to be explicitly clear that CmfMenuBundle must come after KnpMenuBundle in AppKernel HOT 5
- Menu Bundle depends on CoreBundle HOT 4
- [DX] Allow exceptions to be thrown during `PhpcrProvider::has` HOT 4
- Incorrect exception when requested menu does not exist. HOT 2
- [2.0] [Admin] edit doesn't work with content objects HOT 1
- Could not load type "burgov_key_value" HOT 5
- move form types out of sonata admins HOT 1
- symfony 3 support HOT 2
- New File Structure HOT 2
- Upgrade Files HOT 1
- Only register validation metadata when PHPCR is enabled
- symfony 3.0 support HOT 1
- Configure PHPCR ODM child restrictions
- Question HOT 3
- deprecated use of "request" attribute of the "knp_menu.voter" tag HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from menu-bundle.