Changes between Version 1 and Version 2 of Ticket #40927, comment 18
- Timestamp:
- 02/14/2022 02:49:57 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #40927, comment 18
v1 v2 1 1 I found I linked to the changeset incorrectly, which should lead here: https://core.trac.wordpress.org/changeset/52569. 2 2 3 AttachedI copied the handling of `$menu` to `$submenu`.3 In "40927.1.patch" I copied the handling of `$menu` to `$submenu`. 4 4 I removed all strict type checks and simplified the code. 5 5 … … 8 8 Since PHP converts all numerics to weakly typed integers (`$a['1'] === $a[1]`), we can safely cast the position to a string value. 9 9 10 No changes should be noticed by the developers. I suggest allowing `int|float` for `$position` in the PHPDocs; perhaps even the string-equivalent thereof, although I recognize that is difficult to convey. 10 No changes should be noticed by plugin developers. I suggest allowing `int|float` for `$position` in the PHPDocs; perhaps even the string-equivalent thereof, although I recognize that is difficult to convey. 11 12 Aside: I found that `$menu` is sorted only once, but `add_submenu_page()` keeps re-sorting the submenu with every item added. This isn't a big issue, but it's not the most efficient. In any case, I copied the sorting algorithm used for `$menu` and applied it to `$submenu`. 11 13 12 14 ''I see I uploaded a patch of the wrong iteration of my work -- 40927.1.patch will resolve that momentarily.''