Review main Merged

28900[TASK] HMENU: Extract menu item generation into separate methods

Benni Mack CR +2 V +2 Expert +645 −474 updated 01/03/15, 14:20

Commit message

In order to ensure valid options and consistency, the 500+ lines
of code for generating special=XY menus in HMENU
can be safely moved into separate methods within the same
class. Additionally, when subclassing HMENU, the functions
can be overridden easier.

The makeMenu() function gets smaller and the new methods are
a good target for creating unit tests.

Review

  • Code review CR +2
    • Benni Mack +2
    • Stefan Neufeind +1
    • Mathias Schreiber +1
    • Anja Leichsenring +1
  • Verified V +2
    • Benni Mack +2
    • Mathias Schreiber +1
    • Anja Leichsenring +1

Issues 1

Files 1

Review log 26

Show 1 earlier messages
  1. Mr. Jenkins commented on patch set 1 03/27/14, 10:29

  1. Stefan Neufeind commented on patch set 1 04/13/14, 10:31

    Benni, how about the WIP-status of this?
  2. Benni Mack uploaded patch set 2 09/09/14, 13:57

  3. Mathias Schreiber wrote 12/17/14, 20:37

    Topic set to cObj
  4. Stefan Neufeind uploaded patch set 3 12/24/14, 02:12

  5. Stefan Neufeind commented on patch set 3 CR +1 12/24/14, 02:14

    Fully redone according to patch from Benni. Took the original code (just in case it might have been modified meanwhile), split it into separate functions and renamed variable-names when splitting using phpStorm (so I'm quite sure I didn't miss a replacement or so).
  6. Stefan Neufeind uploaded patch set 4 12/24/14, 02:21

  7. Stefan Neufeind commented on patch set 4 CR +1 12/24/14, 02:21

    CGL adjustments done.
  8. Stefan Neufeind commented on patch set 4 12/24/14, 02:23

    Agreed, it might be a horror to review this. But please see that just large chunks were "cut" from the switch-case and put in separate functions (plus renaming $temp to $menuItems inside all the functions).
  9. Mathias Brodala commented on patch set 4 CR -1 12/24/14, 10:01

    Not fully reviewed.

    AbstractMenuContentObject.php:330

    This one is a bit weird. Why not put the (count...) on a new line and keep the implode call as is?

    AbstractMenuContentObject.php:371

    See above

    AbstractMenuContentObject.php:464

    Also weird, why not each serialize call on a separate line?
  10. Stefan Neufeind uploaded patch set 5 12/25/14, 16:07

  11. Stefan Neufeind commented on patch set 5 12/25/14, 16:10

    Did some line-wrappings. Would be great if somebody could look at this, so we can do further cleanups etc. from there on (in separate patches!).
  12. Stefan Neufeind uploaded patch set 6 12/25/14, 16:13

  13. Benni Mack commented on patch set 6 12/26/14, 00:08

    wow. thanks for the rebase, stefan! Hopefully we now get some reviews!
  14. Stefan Neufeind commented on patch set 6 01/01/15, 20:30

    Guys, I don't plan to redo this large patch again and again :-( Due to a recent merge we again ran into a merge-conflict. Are two of you willing to get this through / ready to give reviews, so we can redo it once more and then be done shortly?
  15. Stefan Neufeind uploaded patch set 7 01/01/15, 20:42

  16. Stefan Neufeind commented on patch set 7 01/01/15, 20:43

    Hand-reapplyed changed from "[FEATURE] Add to "additionalWhere" to TypoScript menus" on top of this feature. So please pay special attention to $additionalWhere.
  17. Mathias Brodala commented on patch set 7 CR -1 01/02/15, 07:51

    Mostly nitpicks except one functional change for "user".

    AbstractMenuContentObject.php:409

    Called without $additionalWhere?

    AbstractMenuContentObject.php:512

    This should not be a parameter since it's overwritten in any case below.

    AbstractMenuContentObject.php:514

    $alternativeSortingField is actually nicer.

    AbstractMenuContentObject.php:551

    Why not use $altSortField like all the other calls?

    AbstractMenuContentObject.php:589

    Please add a description here.

    AbstractMenuContentObject.php:595

    Uhm, this was not in the original code. The PHPdoc also clearly states that $specialValue is "not in use here".

    AbstractMenuContentObject.php:660

    Please add a description here.

    AbstractMenuContentObject.php:780

    Please add a description here.

    AbstractMenuContentObject.php:855

    Please add a description here.

    AbstractMenuContentObject.php:892

    I'd rather combine this with the check for $sortingField and only perform this switch in case $sortingField evaluates to FALSE. I'd also re-use the $sortingField variable to not have two similarly named variables for the same purpose.

    AbstractMenuContentObject.php:931

    See above. The "desc" could be appended above in case the switch was performed.

    AbstractMenuContentObject.php:1001

    Please add a description here.

    AbstractMenuContentObject.php:1002

    Same here.

    AbstractMenuContentObject.php:1005

    Please default to '', it's what prepareMenuItems() can end up with and PageRepository::getMenu() accepts.

    AbstractMenuContentObject.php:1119

    Nitpick: Such cleanups are nice but please keep in mind that in case this change needs to be reverted, these cleanups are reverted, too.
  18. Mathias Schreiber uploaded patch set 8 01/02/15, 21:20

  19. Mathias Schreiber voted on patch set 8 CR +1 V +1 01/02/15, 21:40

  20. Andreas Kienast uploaded patch set 9 01/02/15, 21:48

  21. Stefan Neufeind commented on patch set 9 CR +1 01/02/15, 21:58

    Only minor cleanups as far as I saw/heard? Found no nitpicks so far :-)
  22. Mathias Schreiber voted on patch set 9 CR +1 V +1 01/02/15, 22:06

  23. Anja Leichsenring voted on patch set 9 CR +1 V +1 01/03/15, 14:19

  24. Benni Mack voted on patch set 9 CR +2 V +2 01/03/15, 14:20

  25. Benni Mack merged patch set 9 01/03/15, 14:20