<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[13960] sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes: Support HelpHub: Sync with Git WordPress/wporg-documentation-2022@bbe255c</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/13960">13960</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/13960","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>ryelle</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-08-09 19:16:09 +0000 (Fri, 09 Aug 2024)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Support HelpHub: Sync with Git WordPress/wporg-documentation-2022@bbe255c</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginssupporthelphubinchelphubposttypesclassesclasshelphubposttypesposttypephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-post-type.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginssupporthelphubinchelphubposttypesclassesclasshelphubposttypestaxonomyphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-taxonomy.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginssupporthelphubinchelphubposttypesclassesclasshelphubposttypesposttypephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-post-type.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-post-type.php    2024-08-09 07:12:35 UTC (rev 13959)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-post-type.php      2024-08-09 19:16:09 UTC (rev 13960)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -127,14 +127,11 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        add_filter( 'enter_title_here', array( $this, 'enter_title_here' ) );
</span><span class="cx" style="display: block; padding: 0 10px">                        add_filter( 'post_updated_messages', array( $this, 'updated_messages' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( 'edit.php' === $pagenow && isset( $_GET['post_type'] ) && $this->post_type === $_GET['post_type'] ) { // WPCS: input var ok; CSRF ok.
-                               add_filter(
-                                       'manage_edit-' . $this->post_type . '_columns', array(
-                                               $this,
-                                               'register_custom_column_headings',
-                                       ), 10, 1
-                               );
-                               add_action( 'manage_posts_custom_column', array( $this, 'register_custom_columns' ), 10, 2 );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 if ( 'post' !== $this->post_type ) {
+                               $screen_id = 'edit-' . $this->post_type;
+                               add_filter( 'manage_' . $screen_id . '_columns', array( $this, 'register_custom_column_headings' ) );
+                               add_filter( 'manage_' . $screen_id . '_sortable_columns', array( $this, 'register_custom_column_sorts' ) );
+                               add_action( 'manage_' . $this->post_type . '_posts_custom_column', array( $this, 'register_custom_columns' ), 10, 2 );
</ins><span class="cx" style="display: block; padding: 0 10px">                         }
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'admin_init', array( $this, 'add_menu_order' ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -233,9 +230,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                switch ( $column_name ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        case 'image':
</span><span class="cx" style="display: block; padding: 0 10px">                                // Displays img tag.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                                // phpcs:ignore
</ins><span class="cx" style="display: block; padding: 0 10px">                                 echo $this->get_image( $id, 40 );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                /* @codingStandardsIgnoreLine */
</del><span class="cx" style="display: block; padding: 0 10px">                                 break;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                        case 'menu_order':
+                               // Displays menu order value
+                               // phpcs:ignore
+                               echo get_post_field( 'menu_order', $id );
+                               break;
</ins><span class="cx" style="display: block; padding: 0 10px">                         default:
</span><span class="cx" style="display: block; padding: 0 10px">                                break;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -252,7 +254,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return array $defaults
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        public function register_custom_column_headings( $defaults ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $new_columns = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $new_columns = array(
+                       'menu_order' => __( 'Order', 'wporg-forums' ),
+               );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $last_item = array();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -278,6 +282,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">        } // End register_custom_column_headings()
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         * Enable sorting on columns.
+        *
+        * @param array $cols An array of sortable columns.
+        * @return array Updated list of columns.
+        */
+       public function register_custom_column_sorts( $cols ) {
+               $cols['menu_order'] = array(
+                       'menu_order',
+                       true,
+                       __( 'Order', 'wporg-forums' ),
+                       __( 'Table ordered by order.', 'wporg-forums' ),
+               );
+
+               return $cols;
+       } // End register_custom_column_sorts()
+
+       /**
</ins><span class="cx" style="display: block; padding: 0 10px">          * Update messages for the post type admin.
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @since  1.0.0
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginssupporthelphubinchelphubposttypesclassesclasshelphubposttypestaxonomyphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-taxonomy.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-taxonomy.php     2024-08-09 07:12:35 UTC (rev 13959)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/helphub-post-types/classes/class-helphub-post-types-taxonomy.php       2024-08-09 19:16:09 UTC (rev 13960)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -72,7 +72,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">         *
</span><span class="cx" style="display: block; padding: 0 10px">         * @access  public
</span><span class="cx" style="display: block; padding: 0 10px">         * @since   1.3.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-         * @param   array $post_type The post type key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+  * @param   array  $post_type The post type key.
</ins><span class="cx" style="display: block; padding: 0 10px">          * @param   string $token     The taxonomy key.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param   string $singular  Singular name.
</span><span class="cx" style="display: block; padding: 0 10px">         * @param   string $plural    Plural name.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,6 +94,26 @@
</span><span class="cx" style="display: block; padding: 0 10px">                $this->args = wp_parse_args( $args, $this->_get_default_args() );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                add_action( 'init', array( $this, 'register' ) );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+               if ( 'category' === $this->token ) {
+                       add_action(
+                               'load-edit-tags.php',
+                               function() {
+                                       $screen_id = 'edit-' . $this->token;
+                                       add_filter( 'manage_' . $screen_id . '_columns', array( $this, 'register_custom_column_headings' ) );
+                                       add_filter( 'manage_' . $screen_id . '_sortable_columns', array( $this, 'register_custom_column_sorts' ) );
+                                       add_filter( 'manage_' . $this->token . '_custom_column', array( $this, 'register_custom_columns' ), 10, 3 );
+
+                                       add_action( 'pre_get_terms', array( $this, 'list_table_do_custom_sort' ) );
+                                       add_action(
+                                               'admin_head',
+                                               function() {
+                                                       echo '<style>table .column-sort_order{width: 5rem;}</style>';
+                                               }
+                                       );
+                               }
+                       );
+               }
</ins><span class="cx" style="display: block; padding: 0 10px">         } // End __construct()
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -161,4 +181,71 @@
</span><span class="cx" style="display: block; padding: 0 10px">        public function register() {
</span><span class="cx" style="display: block; padding: 0 10px">                register_taxonomy( esc_attr( $this->token ), (array) $this->post_type, (array) $this->args );
</span><span class="cx" style="display: block; padding: 0 10px">        } // End register()
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+       /**
+        * Add custom column headings for the "manage" screen of this post type.
+        *
+        * @param array $columns The default value.
+        *
+        * @return array
+        */
+       public function register_custom_column_headings( $columns ) {
+               $new_columns = array(
+                       'sort_order' => __( 'Order', 'wporg-forums' ),
+               );
+               $columns = array_merge( array_slice( $columns, 0, 1 ), $new_columns, array_slice( $columns, 1 ) );
+               return $columns;
+       }
+
+       /**
+        * Enable sorting on columns.
+        *
+        * @param array $cols An array of sortable columns.
+        * @return array Updated list of columns.
+        */
+       public function register_custom_column_sorts( $cols ) {
+               $cols['sort_order'] = array(
+                       'sort_order',
+                       true,
+                       __( 'Order', 'wporg-forums' ),
+                       __( 'Table ordered by order.', 'wporg-forums' ),
+               );
+
+               return $cols;
+       } // End register_custom_column_sorts()
+
+       /**
+        * Add custom columns for the "manage" screen of this post type.
+        *
+        * @access public
+        *
+        * @param string $value Filter content (value of column).
+        * @param string $column_name The name of the column.
+        * @param int    $id The ID.
+        *
+        * @since  1.0.0
+        * @return void
+        */
+       public function register_custom_columns( $value, $column_name, $id ) {
+               switch ( $column_name ) {
+                       case 'sort_order':
+                               // phpcs:ignore
+                               echo get_term_meta( $id, 'sort_order', true );
+                               break;
+                       default:
+                               break;
+               }
+       } // End register_custom_columns()
+
+       /**
+        * Filter the term query if our custom sort is used.
+        *
+        * @param WP_Term_Query $term_query Current instance of WP_Term_Query (passed by reference).
+        */
+       public function list_table_do_custom_sort( $term_query ) {
+               if ( isset( $term_query->query_vars['orderby'] ) && 'sort_order' === $term_query->query_vars['orderby'] ) {
+                       $term_query->query_vars['orderby'] = 'meta_value_num';
+                       $term_query->query_vars['meta_key'] = 'sort_order';
+               }
+       }
</ins><span class="cx" style="display: block; padding: 0 10px"> } // End Class
</span></span></pre>
</div>
</div>

</body>
</html>