Make WordPress Core

Ticket #40178: 40178.2.patch

File 40178.2.patch, 3.7 KB (added by desrosj, 7 years ago)

Replaces space indentation with tabs. Still configuring new editor.

  • src/wp-admin/css/nav-menus.css

     
    460460        border-color: #f1acb1;
    461461}
    462462
     463#menu-to-edit .menu-item-unpublished .menu-item-handle {
     464        background: #fff8e5;
     465        border-color: #ffb900;
     466}
     467
    463468.no-js .menu-item-edit-active .item-edit {
    464469        display: none;
    465470}
  • src/wp-admin/includes/class-walker-nav-menu-edit.php

     
    101101                        $classes[] = 'pending';
    102102                        /* translators: %s: title of menu item in draft status */
    103103                        $title = sprintf( __('%s (Pending)'), $item->title );
     104                } elseif ( 'post_type' === $item->type && 'publish' !== get_post_status( $item->object_id ) ) {
     105                        $classes[] = 'menu-item-unpublished';
     106                        /* translators: %s: title of menu item which is unpublished */
     107                        $title = sprintf( __( '%s (Unpublished)' ), $item->title );
    104108                }
    105109
    106110                $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label;
  • src/wp-admin/includes/nav-menu.php

     
    938938                        );
    939939                }
    940940
    941                 $some_pending_menu_items = $some_invalid_menu_items = false;
     941                $some_pending_menu_items = $some_invalid_menu_items = $some_unpublished_menu_items = false;
    942942                foreach ( (array) $menu_items as $menu_item ) {
    943                         if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status )
    944                                 $some_pending_menu_items = true;
    945                         if ( ! empty( $menu_item->_invalid ) )
     943                        if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status ) {
     944                        $some_pending_menu_items = true;
     945                }
     946
     947                        if ( ! empty( $menu_item->_invalid ) ) {
    946948                                $some_invalid_menu_items = true;
     949                        }
     950
     951                        if ( 'post_type' === $menu_item->type && 'publish' !== get_post_status( $menu_item->object_id ) ) {
     952                                $some_unpublished_menu_items = true;
     953                        }
    947954                }
    948955
    949956                if ( $some_pending_menu_items ) {
     
    954961                        $result .= '<div class="notice notice-error notice-alt inline"><p>' . __( 'There are some invalid menu items. Please check or delete them.' ) . '</p></div>';
    955962                }
    956963
     964                if ( $some_unpublished_menu_items ) {
     965                        $result .= '<div class="notice notice-warning notice-alt inline"><p>' . __( 'Some menu items are unpublished. They will not appear until published.' ) . '</p></div>';
     966                }
     967
    957968                $result .= '<ul class="menu" id="menu-to-edit"> ';
    958969                $result .= walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) );
    959970                $result .= ' </ul> ';
  • src/wp-includes/nav-menu.php

     
    574574}
    575575
    576576/**
     577 * Determine if a menu item is published.
     578 *
     579 * @link https://core.trac.wordpress.org/ticket/13958
     580 *
     581 * @since 4.8.0
     582 * @access private
     583 *
     584 * @param object $item The menu item to check.
     585 * @return bool False if invalid, otherwise true.
     586 */
     587function _is_published_nav_menu_item( $item ) {
     588        return 'publish' === get_post_status( $item->object_id );
     589}
     590
     591/**
    577592 * Return all menu items of a navigation menu.
    578593 *
    579594 * @since 3.0.0
     
    648663
    649664        if ( ! is_admin() ) { // Remove invalid items only in front end
    650665                $items = array_filter( $items, '_is_valid_nav_menu_item' );
     666                $items = array_filter( $items, '_is_published_nav_menu_item' );
    651667        }
    652668
    653669        if ( ARRAY_A == $args['output'] ) {