2015-09-15 00:02:25 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Navigation Menu API: Walker_Nav_Menu_Edit class
|
|
|
|
*
|
|
|
|
* @package WordPress
|
2015-10-15 13:26:24 -04:00
|
|
|
* @subpackage Administration
|
2015-09-15 00:02:25 -04:00
|
|
|
* @since 4.4.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create HTML list of nav menu input items.
|
|
|
|
*
|
|
|
|
* @since 3.0.0
|
2017-07-01 12:49:40 -04:00
|
|
|
*
|
|
|
|
* @see Walker_Nav_Menu
|
2015-09-15 00:02:25 -04:00
|
|
|
*/
|
|
|
|
class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
|
|
|
/**
|
|
|
|
* Starts the list before the elements are added.
|
|
|
|
*
|
|
|
|
* @see Walker_Nav_Menu::start_lvl()
|
|
|
|
*
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2020-02-05 02:25:05 -05:00
|
|
|
* @param string $output Passed by reference.
|
|
|
|
* @param int $depth Depth of menu item. Used for padding.
|
|
|
|
* @param stdClass $args Not used.
|
2015-09-15 00:02:25 -04:00
|
|
|
*/
|
2020-02-05 02:25:05 -05:00
|
|
|
public function start_lvl( &$output, $depth = 0, $args = null ) {}
|
2015-09-15 00:02:25 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Ends the list of after the elements are added.
|
|
|
|
*
|
|
|
|
* @see Walker_Nav_Menu::end_lvl()
|
|
|
|
*
|
|
|
|
* @since 3.0.0
|
|
|
|
*
|
2020-02-05 02:25:05 -05:00
|
|
|
* @param string $output Passed by reference.
|
|
|
|
* @param int $depth Depth of menu item. Used for padding.
|
|
|
|
* @param stdClass $args Not used.
|
2015-09-15 00:02:25 -04:00
|
|
|
*/
|
2020-02-05 02:25:05 -05:00
|
|
|
public function end_lvl( &$output, $depth = 0, $args = null ) {}
|
2015-09-15 00:02:25 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Start the element output.
|
|
|
|
*
|
|
|
|
* @see Walker_Nav_Menu::start_el()
|
|
|
|
* @since 3.0.0
|
Code Modernization: Fix last parameter name mismatches for parent/child classes in `Walker::start_el()`.
The parent class uses `$current_object_id` while most of the child classes use `$id`. As the parent class' is more descriptive, renaming the last parameter in each of child class.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- In cases where the original parameter name was too generic or misleading, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189], [51739].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51779
git-svn-id: http://core.svn.wordpress.org/trunk@51386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 08:39:59 -04:00
|
|
|
* @since 5.9.0 Renamed `$item` to `$data_object` and `$id` to `$current_object_id`
|
|
|
|
* to match parent class for PHP 8 named parameter support.
|
2015-09-15 00:02:25 -04:00
|
|
|
*
|
|
|
|
* @global int $_wp_nav_menu_max_depth
|
|
|
|
*
|
Code Modernization: Fix last parameter name mismatches for parent/child classes in `Walker::start_el()`.
The parent class uses `$current_object_id` while most of the child classes use `$id`. As the parent class' is more descriptive, renaming the last parameter in each of child class.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- In cases where the original parameter name was too generic or misleading, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189], [51739].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51779
git-svn-id: http://core.svn.wordpress.org/trunk@51386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 08:39:59 -04:00
|
|
|
* @param string $output Used to append additional content (passed by reference).
|
|
|
|
* @param WP_Post $data_object Menu item data object.
|
|
|
|
* @param int $depth Depth of menu item. Used for padding.
|
|
|
|
* @param stdClass $args Not used.
|
|
|
|
* @param int $current_object_id Optional. ID of the current menu item. Default 0.
|
2015-09-15 00:02:25 -04:00
|
|
|
*/
|
Code Modernization: Fix last parameter name mismatches for parent/child classes in `Walker::start_el()`.
The parent class uses `$current_object_id` while most of the child classes use `$id`. As the parent class' is more descriptive, renaming the last parameter in each of child class.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- In cases where the original parameter name was too generic or misleading, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189], [51739].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51779
git-svn-id: http://core.svn.wordpress.org/trunk@51386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 08:39:59 -04:00
|
|
|
public function start_el( &$output, $data_object, $depth = 0, $args = null, $current_object_id = 0 ) {
|
2015-09-15 00:02:25 -04:00
|
|
|
global $_wp_nav_menu_max_depth;
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
|
|
|
|
// Restores the more descriptive, specific name for use within this method.
|
|
|
|
$menu_item = $data_object;
|
2015-09-15 00:02:25 -04:00
|
|
|
$_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
|
|
|
|
|
|
|
|
ob_start();
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
$item_id = esc_attr( $menu_item->ID );
|
2015-09-15 00:02:25 -04:00
|
|
|
$removed_args = array(
|
|
|
|
'action',
|
|
|
|
'customlink-tab',
|
|
|
|
'edit-menu-item',
|
|
|
|
'menu-item',
|
|
|
|
'page-tab',
|
|
|
|
'_wpnonce',
|
|
|
|
);
|
|
|
|
|
2016-07-04 16:16:28 -04:00
|
|
|
$original_title = false;
|
2019-08-25 17:32:59 -04:00
|
|
|
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
if ( 'taxonomy' === $menu_item->type ) {
|
|
|
|
$original_object = get_term( (int) $menu_item->object_id, $menu_item->object );
|
2020-06-17 15:47:14 -04:00
|
|
|
if ( $original_object && ! is_wp_error( $original_object ) ) {
|
2019-08-25 17:32:59 -04:00
|
|
|
$original_title = $original_object->name;
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
} elseif ( 'post_type' === $menu_item->type ) {
|
|
|
|
$original_object = get_post( $menu_item->object_id );
|
2019-08-25 17:32:59 -04:00
|
|
|
if ( $original_object ) {
|
|
|
|
$original_title = get_the_title( $original_object->ID );
|
|
|
|
}
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
} elseif ( 'post_type_archive' === $menu_item->type ) {
|
|
|
|
$original_object = get_post_type_object( $menu_item->object );
|
2015-12-25 23:05:25 -05:00
|
|
|
if ( $original_object ) {
|
|
|
|
$original_title = $original_object->labels->archives;
|
|
|
|
}
|
2015-09-15 00:02:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
$classes = array(
|
|
|
|
'menu-item menu-item-depth-' . $depth,
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
'menu-item-' . esc_attr( $menu_item->object ),
|
2021-04-17 08:22:03 -04:00
|
|
|
'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id === $_GET['edit-menu-item'] ) ? 'active' : 'inactive' ),
|
2015-09-15 00:02:25 -04:00
|
|
|
);
|
|
|
|
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
$title = $menu_item->title;
|
2015-09-15 00:02:25 -04:00
|
|
|
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
if ( ! empty( $menu_item->_invalid ) ) {
|
2015-09-15 00:02:25 -04:00
|
|
|
$classes[] = 'menu-item-invalid';
|
2019-09-02 20:41:05 -04:00
|
|
|
/* translators: %s: Title of an invalid menu item. */
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
$title = sprintf( __( '%s (Invalid)' ), $menu_item->title );
|
|
|
|
} elseif ( isset( $menu_item->post_status ) && 'draft' === $menu_item->post_status ) {
|
2015-09-15 00:02:25 -04:00
|
|
|
$classes[] = 'pending';
|
2019-09-02 20:41:05 -04:00
|
|
|
/* translators: %s: Title of a menu item in draft status. */
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
$title = sprintf( __( '%s (Pending)' ), $menu_item->title );
|
2015-09-15 00:02:25 -04:00
|
|
|
}
|
|
|
|
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
$title = ( ! isset( $menu_item->label ) || '' === $menu_item->label ) ? $title : $menu_item->label;
|
2015-09-15 00:02:25 -04:00
|
|
|
|
|
|
|
$submenu_text = '';
|
2021-04-17 08:22:03 -04:00
|
|
|
if ( 0 === $depth ) {
|
2015-09-15 00:02:25 -04:00
|
|
|
$submenu_text = 'style="display: none;"';
|
2017-11-30 18:11:00 -05:00
|
|
|
}
|
2015-09-15 00:02:25 -04:00
|
|
|
|
|
|
|
?>
|
2017-11-30 18:11:00 -05:00
|
|
|
<li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode( ' ', $classes ); ?>">
|
2015-09-15 00:02:25 -04:00
|
|
|
<div class="menu-item-bar">
|
|
|
|
<div class="menu-item-handle">
|
2021-05-25 15:14:57 -04:00
|
|
|
<label class="item-title" for="menu-item-checkbox-<?php echo $item_id; ?>">
|
|
|
|
<input id="menu-item-checkbox-<?php echo $item_id; ?>" type="checkbox" class="menu-item-checkbox" data-menu-item-id="<?php echo $item_id; ?>" disabled="disabled" />
|
|
|
|
<span class="menu-item-title"><?php echo esc_html( $title ); ?></span>
|
|
|
|
<span class="is-submenu" <?php echo $submenu_text; ?>><?php _e( 'sub item' ); ?></span>
|
|
|
|
</label>
|
2015-09-15 00:02:25 -04:00
|
|
|
<span class="item-controls">
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<span class="item-type"><?php echo esc_html( $menu_item->type_label ); ?></span>
|
2015-09-15 00:02:25 -04:00
|
|
|
<span class="item-order hide-if-js">
|
2017-11-30 18:11:00 -05:00
|
|
|
<?php
|
2019-07-09 16:45:56 -04:00
|
|
|
printf(
|
|
|
|
'<a href="%s" class="item-move-up" aria-label="%s">↑</a>',
|
|
|
|
wp_nonce_url(
|
2015-09-15 00:02:25 -04:00
|
|
|
add_query_arg(
|
|
|
|
array(
|
2017-11-30 18:11:00 -05:00
|
|
|
'action' => 'move-up-menu-item',
|
2015-09-15 00:02:25 -04:00
|
|
|
'menu-item' => $item_id,
|
|
|
|
),
|
2017-11-30 18:11:00 -05:00
|
|
|
remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) )
|
2015-09-15 00:02:25 -04:00
|
|
|
),
|
|
|
|
'move-menu_item'
|
2019-07-09 16:45:56 -04:00
|
|
|
),
|
|
|
|
esc_attr__( 'Move up' )
|
|
|
|
);
|
2017-11-30 18:11:00 -05:00
|
|
|
?>
|
2015-09-15 00:02:25 -04:00
|
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
<?php
|
2019-07-09 16:45:56 -04:00
|
|
|
printf(
|
|
|
|
'<a href="%s" class="item-move-down" aria-label="%s">↓</a>',
|
|
|
|
wp_nonce_url(
|
2015-09-15 00:02:25 -04:00
|
|
|
add_query_arg(
|
|
|
|
array(
|
2017-11-30 18:11:00 -05:00
|
|
|
'action' => 'move-down-menu-item',
|
2015-09-15 00:02:25 -04:00
|
|
|
'menu-item' => $item_id,
|
|
|
|
),
|
2017-11-30 18:11:00 -05:00
|
|
|
remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) )
|
2015-09-15 00:02:25 -04:00
|
|
|
),
|
|
|
|
'move-menu_item'
|
2019-07-09 16:45:56 -04:00
|
|
|
),
|
|
|
|
esc_attr__( 'Move down' )
|
|
|
|
);
|
2017-11-30 18:11:00 -05:00
|
|
|
?>
|
2015-09-15 00:02:25 -04:00
|
|
|
</span>
|
2019-07-09 16:45:56 -04:00
|
|
|
<?php
|
2021-04-17 08:22:03 -04:00
|
|
|
if ( isset( $_GET['edit-menu-item'] ) && $item_id === $_GET['edit-menu-item'] ) {
|
2019-07-09 16:45:56 -04:00
|
|
|
$edit_url = admin_url( 'nav-menus.php' );
|
|
|
|
} else {
|
|
|
|
$edit_url = add_query_arg(
|
|
|
|
array(
|
|
|
|
'edit-menu-item' => $item_id,
|
|
|
|
),
|
|
|
|
remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf(
|
|
|
|
'<a class="item-edit" id="edit-%s" href="%s" aria-label="%s"><span class="screen-reader-text">%s</span></a>',
|
|
|
|
$item_id,
|
|
|
|
$edit_url,
|
|
|
|
esc_attr__( 'Edit menu item' ),
|
|
|
|
__( 'Edit' )
|
|
|
|
);
|
|
|
|
?>
|
2015-09-15 00:02:25 -04:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2016-01-30 08:46:27 -05:00
|
|
|
<div class="menu-item-settings wp-clearfix" id="menu-item-settings-<?php echo $item_id; ?>">
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<?php if ( 'custom' === $menu_item->type ) : ?>
|
2015-09-15 00:02:25 -04:00
|
|
|
<p class="field-url description description-wide">
|
|
|
|
<label for="edit-menu-item-url-<?php echo $item_id; ?>">
|
|
|
|
<?php _e( 'URL' ); ?><br />
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->url ); ?>" />
|
2015-09-15 00:02:25 -04:00
|
|
|
</label>
|
|
|
|
</p>
|
|
|
|
<?php endif; ?>
|
|
|
|
<p class="description description-wide">
|
|
|
|
<label for="edit-menu-item-title-<?php echo $item_id; ?>">
|
|
|
|
<?php _e( 'Navigation Label' ); ?><br />
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->title ); ?>" />
|
2015-09-15 00:02:25 -04:00
|
|
|
</label>
|
|
|
|
</p>
|
2016-03-30 17:55:27 -04:00
|
|
|
<p class="field-title-attribute field-attr-title description description-wide">
|
2015-09-15 00:02:25 -04:00
|
|
|
<label for="edit-menu-item-attr-title-<?php echo $item_id; ?>">
|
|
|
|
<?php _e( 'Title Attribute' ); ?><br />
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->post_excerpt ); ?>" />
|
2015-09-15 00:02:25 -04:00
|
|
|
</label>
|
|
|
|
</p>
|
|
|
|
<p class="field-link-target description">
|
|
|
|
<label for="edit-menu-item-target-<?php echo $item_id; ?>">
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<input type="checkbox" id="edit-menu-item-target-<?php echo $item_id; ?>" value="_blank" name="menu-item-target[<?php echo $item_id; ?>]"<?php checked( $menu_item->target, '_blank' ); ?> />
|
2015-09-15 00:02:25 -04:00
|
|
|
<?php _e( 'Open link in a new tab' ); ?>
|
|
|
|
</label>
|
|
|
|
</p>
|
|
|
|
<p class="field-css-classes description description-thin">
|
|
|
|
<label for="edit-menu-item-classes-<?php echo $item_id; ?>">
|
|
|
|
<?php _e( 'CSS Classes (optional)' ); ?><br />
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode( ' ', $menu_item->classes ) ); ?>" />
|
2015-09-15 00:02:25 -04:00
|
|
|
</label>
|
|
|
|
</p>
|
|
|
|
<p class="field-xfn description description-thin">
|
|
|
|
<label for="edit-menu-item-xfn-<?php echo $item_id; ?>">
|
|
|
|
<?php _e( 'Link Relationship (XFN)' ); ?><br />
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->xfn ); ?>" />
|
2015-09-15 00:02:25 -04:00
|
|
|
</label>
|
|
|
|
</p>
|
|
|
|
<p class="field-description description description-wide">
|
|
|
|
<label for="edit-menu-item-description-<?php echo $item_id; ?>">
|
|
|
|
<?php _e( 'Description' ); ?><br />
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $menu_item->description ); // textarea_escaped ?></textarea>
|
2017-11-30 18:11:00 -05:00
|
|
|
<span class="description"><?php _e( 'The description will be displayed in the menu if the current theme supports it.' ); ?></span>
|
2015-09-15 00:02:25 -04:00
|
|
|
</label>
|
|
|
|
</p>
|
|
|
|
|
2020-02-05 02:43:05 -05:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Fires just before the move buttons of a nav menu item in the menu editor.
|
|
|
|
*
|
|
|
|
* @since 5.4.0
|
|
|
|
*
|
Code Modernization: Fix last parameter name mismatches for parent/child classes in `Walker::start_el()`.
The parent class uses `$current_object_id` while most of the child classes use `$id`. As the parent class' is more descriptive, renaming the last parameter in each of child class.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- In cases where the original parameter name was too generic or misleading, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189], [51739].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51779
git-svn-id: http://core.svn.wordpress.org/trunk@51386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 08:39:59 -04:00
|
|
|
* @param int $item_id Menu item ID.
|
|
|
|
* @param WP_Post $menu_item Menu item data object.
|
|
|
|
* @param int $depth Depth of menu item. Used for padding.
|
|
|
|
* @param stdClass $args An object of menu item arguments.
|
|
|
|
* @param int $current_object_id Nav menu ID.
|
2020-02-05 02:43:05 -05:00
|
|
|
*/
|
Code Modernization: Fix last parameter name mismatches for parent/child classes in `Walker::start_el()`.
The parent class uses `$current_object_id` while most of the child classes use `$id`. As the parent class' is more descriptive, renaming the last parameter in each of child class.
Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- In cases where the original parameter name was too generic or misleading, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189], [51739].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51779
git-svn-id: http://core.svn.wordpress.org/trunk@51386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 08:39:59 -04:00
|
|
|
do_action( 'wp_nav_menu_item_custom_fields', $item_id, $menu_item, $depth, $args, $current_object_id );
|
2020-02-05 02:43:05 -05:00
|
|
|
?>
|
|
|
|
|
2016-10-10 12:26:12 -04:00
|
|
|
<fieldset class="field-move hide-if-no-js description description-wide">
|
|
|
|
<span class="field-move-visual-label" aria-hidden="true"><?php _e( 'Move' ); ?></span>
|
|
|
|
<button type="button" class="button-link menus-move menus-move-up" data-dir="up"><?php _e( 'Up one' ); ?></button>
|
|
|
|
<button type="button" class="button-link menus-move menus-move-down" data-dir="down"><?php _e( 'Down one' ); ?></button>
|
|
|
|
<button type="button" class="button-link menus-move menus-move-left" data-dir="left"></button>
|
|
|
|
<button type="button" class="button-link menus-move menus-move-right" data-dir="right"></button>
|
|
|
|
<button type="button" class="button-link menus-move menus-move-top" data-dir="top"><?php _e( 'To the top' ); ?></button>
|
|
|
|
</fieldset>
|
2015-09-15 00:02:25 -04:00
|
|
|
|
|
|
|
<div class="menu-item-actions description-wide submitbox">
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<?php if ( 'custom' !== $menu_item->type && false !== $original_title ) : ?>
|
2015-09-15 00:02:25 -04:00
|
|
|
<p class="link-to-original">
|
2018-08-30 09:36:25 -04:00
|
|
|
<?php
|
2019-09-02 20:41:05 -04:00
|
|
|
/* translators: %s: Link to menu item's original object. */
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
printf( __( 'Original: %s' ), '<a href="' . esc_attr( $menu_item->url ) . '">' . esc_html( $original_title ) . '</a>' );
|
2018-08-30 09:36:25 -04:00
|
|
|
?>
|
2015-09-15 00:02:25 -04:00
|
|
|
</p>
|
|
|
|
<?php endif; ?>
|
2019-07-09 16:45:56 -04:00
|
|
|
|
2017-11-30 18:11:00 -05:00
|
|
|
<?php
|
2019-07-09 16:45:56 -04:00
|
|
|
printf(
|
|
|
|
'<a class="item-delete submitdelete deletion" id="delete-%s" href="%s">%s</a>',
|
|
|
|
$item_id,
|
|
|
|
wp_nonce_url(
|
|
|
|
add_query_arg(
|
|
|
|
array(
|
|
|
|
'action' => 'delete-menu-item',
|
|
|
|
'menu-item' => $item_id,
|
|
|
|
),
|
|
|
|
admin_url( 'nav-menus.php' )
|
2018-08-16 21:51:36 -04:00
|
|
|
),
|
2019-07-09 16:45:56 -04:00
|
|
|
'delete-menu_item_' . $item_id
|
|
|
|
),
|
|
|
|
__( 'Remove' )
|
|
|
|
);
|
|
|
|
?>
|
|
|
|
<span class="meta-sep hide-if-no-js"> | </span>
|
|
|
|
<?php
|
|
|
|
printf(
|
|
|
|
'<a class="item-cancel submitcancel hide-if-no-js" id="cancel-%s" href="%s#menu-item-settings-%s">%s</a>',
|
|
|
|
$item_id,
|
|
|
|
esc_url(
|
|
|
|
add_query_arg(
|
|
|
|
array(
|
|
|
|
'edit-menu-item' => $item_id,
|
|
|
|
'cancel' => time(),
|
|
|
|
),
|
|
|
|
admin_url( 'nav-menus.php' )
|
|
|
|
)
|
|
|
|
),
|
|
|
|
$item_id,
|
|
|
|
__( 'Cancel' )
|
2017-11-30 18:11:00 -05:00
|
|
|
);
|
2018-08-16 21:51:36 -04:00
|
|
|
?>
|
2015-09-15 00:02:25 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" />
|
Code Modernization: Fix reserved keyword and parameter name mismatches for parent/child classes in `Walker::start_el()`.
In the parent class, renames the parameter `$object` to `$data_object`.
Why? `object` is a PHP reserved keyword.
In each child class: renames the corresponding parameter to match the parent's method signature.
Why?
PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.
Changes for readability:
- `@since` clearly specifies the original parameter name and its new name as well as why the change happened.
- in methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.
- in cases where the original parameter name was too generic, renamed (when reassigning) to a more descriptive name for use within the method.
Follow-up to [7737], [8900], [8970], [14248], [15077], [16100], [25642], [25644], [37051], [37054], [37056], [46271], [47189].
Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.
Built from https://develop.svn.wordpress.org/trunk@51739
git-svn-id: http://core.svn.wordpress.org/trunk@51347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 11:36:59 -04:00
|
|
|
<input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->object_id ); ?>" />
|
|
|
|
<input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->object ); ?>" />
|
|
|
|
<input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->menu_item_parent ); ?>" />
|
|
|
|
<input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->menu_order ); ?>" />
|
|
|
|
<input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $menu_item->type ); ?>" />
|
2015-09-15 00:02:25 -04:00
|
|
|
</div><!-- .menu-item-settings-->
|
|
|
|
<ul class="menu-item-transport"></ul>
|
|
|
|
<?php
|
|
|
|
$output .= ob_get_clean();
|
|
|
|
}
|
|
|
|
|
2020-01-28 19:45:18 -05:00
|
|
|
}
|