[wp-trac] [WordPress Trac] #36832: Refactor for class-walker-nav-menu-edit.php

WordPress Trac noreply at wordpress.org
Tue May 17 18:04:14 UTC 2016


#36832: Refactor for class-walker-nav-menu-edit.php
-------------------------+-----------------------------
 Reporter:  iamntz       |       Owner:
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:
Component:  Menus        |     Version:  trunk
 Severity:  normal       |  Resolution:  wontfix
 Keywords:  has-patch    |     Focuses:  administration
-------------------------+-----------------------------

Comment (by iamntz):

 Hey Boone, thanks for reviewing.

 The reason for using add action instead calling the methods is simple: it
 provides a bigger flexibility (i.e. what if you want to add a custom field
 ''before'' default fields? Do it my way and you only to change priority of
 the custom hook; what if you want - for some crazy reason - to remove all
 fields?) and reduces responsibilities for the main method.

 Additionally, unit tests could be written more easily, without depending
 on too many stuff.

 ----

 About refactoring: this patch, besides enabling couple of extra hooks,
 will be more friendly in case you need to extend the Walker. Instead of
 copying a 100 lines method to change something trivial, you only need to
 copy few lines tops.

 I wasn't aware of this policy of not refactoring.

 Thanks again!

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36832#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list