Making WordPress.org


Ignore:
Timestamp:
03/21/2016 10:41:10 PM (10 years ago)
Author:
obenland
Message:

Plugin Directory: Make edit.php more of a dashboard for plugin authors.

H/t mcguive7.

See #1571.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-customizations.php

    r2752 r2776  
    22namespace WordPressdotorg\Plugin_Directory\Admin;
    33use \WordPressdotorg\Plugin_Directory;
     4use \WordPressdotorg\Plugin_Directory\Admin\List_Table\Plugin_Posts;
    45
    56/**
     
    3031
    3132                add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_assets' ) );
     33                add_filter( 'admin_head-edit.php', array( $this, 'plugin_posts_list_table' ) );
    3234
    3335                add_action( 'wp_ajax_replyto-comment', array( $this, 'save_custom_comment' ), 0 );
     
    6567                global $post_type;
    6668
    67                 if ( 'post.php' === $hook_suffix && 'plugin' === $post_type ) {
    68                         wp_enqueue_style( 'plugin-admin-edit-css', plugins_url( 'css/edit-form.css', Plugin_Directory\PLUGIN_FILE ), array( 'edit' ), 1 );
    69                         wp_enqueue_script( 'plugin-admin-edit-js', plugins_url( 'js/edit-form.js', Plugin_Directory\PLUGIN_FILE ), array( 'wp-util', 'wp-lists' ), 1 );
    70                         wp_localize_script( 'plugin-admin-edit-js', 'pluginDirectory', array(
    71                                 'removeCommitterAYS' => __( 'Are you sure you want to remove this committer?', 'wporg-plugins' ),
    72                         ) );
     69                if ( 'plugin' === $post_type ) {
     70                        switch ( $hook_suffix ) {
     71                                case 'post.php':
     72                                        wp_enqueue_style( 'plugin-admin-post-css', plugins_url( 'css/edit-form.css', Plugin_Directory\PLUGIN_FILE ), array( 'edit' ), 1 );
     73                                        wp_enqueue_script( 'plugin-admin-post-js', plugins_url( 'js/edit-form.js', Plugin_Directory\PLUGIN_FILE ), array( 'wp-util', 'wp-lists' ), 1 );
     74                                        wp_localize_script( 'plugin-admin-post-js', 'pluginDirectory', array(
     75                                                'removeCommitterAYS' => __( 'Are you sure you want to remove this committer?', 'wporg-plugins' ),
     76                                        ) );
     77                                        break;
     78
     79                                case 'edit.php':
     80                                        wp_enqueue_style( 'plugin-admin-edit-css', plugins_url( 'css/plugin-list.css', Plugin_Directory\PLUGIN_FILE ), array(), 1 );
     81                                        break;
     82                        }
     83                }
     84        }
     85
     86        /**
     87         * Replaces the WP_Posts_List_Table object with the extended Plugin_Posts list table object.
     88         *
     89         * @global string               $post_type     The current post type.
     90         * @global \WP_Posts_List_Table $wp_list_table The WP_Posts_List_Table object.
     91         */
     92        public function plugin_posts_list_table() {
     93                global $post_type, $wp_list_table;
     94
     95                if ( 'plugin' === $post_type ) {
     96                        $wp_list_table = new Plugin_Posts();
    7397                }
    7498        }
Note: See TracChangeset for help on using the changeset viewer.