Code Monkey home page Code Monkey logo

Comments (5)

dbu avatar dbu commented on August 26, 2024

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.

dantleech avatar dantleech commented on August 26, 2024

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.

dbu avatar dbu commented on August 26, 2024

yep, sounds good. its kind of "nice to have" for 1.0 but would be nice
indeed.

from menu-bundle.

dantleech avatar dantleech commented on August 26, 2024

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.

dbu avatar dbu commented on August 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.