forked from WordPress/WordPress
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Architecture? #3
Comments
bueltge
added a commit
that referenced
this issue
Mar 5, 2014
@bueltge I had a look at your commit from 2 month ago. |
Yep. <?php
/**
* Plugin Name: Network Tab Patch Test Case
* Plugin URI: https://core.trac.wordpress.org/ticket/15800
* Description: Test use case for the patch to allow extension of network site tabs
*/
if ( ! is_network_admin() )
exit;
function network_site_tabs_test() {
global $_registered_pages;
add_filter( 'network_edit_site_tabs', 'filter_network_tabs', 10, 3 );
$hookname = get_plugin_page_hookname( 'wp_test_tab', '' );
$_registered_pages[$hookname] = true;
if ( isset( $_GET['page'] ) && $_GET['page'] == 'wp_test_tab' )
add_action( $hookname, 'test_tab_callback' );
}
add_action( 'network_admin_menu', 'network_site_tabs_test' );
function filter_network_tabs( $tabs, $id, $pagenow ) {
$tabs['test-tab'] = array( 'label' => __( 'Test Tab' ), 'menu-slug' => 'wp_test_tab', 'callback-function' => 'test_tab_callback' );
return $tabs;
}
function test_tab_callback() {
$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
$site_url_no_http = preg_replace( '#^http(s)?://#', '', get_blogaddress_by_id( $id ) );
$title_site_url_linked = sprintf( __( 'Edit Site: <a href="%1$s">%2$s</a>' ), get_blogaddress_by_id( $id ), $site_url_no_http );
?>
<div class="wrap">
<h2 id="edit-site"><?php echo $title_site_url_linked ?></h2>
<h3 class="nav-tab-wrapper">
<?php if ( function_exists( 'network_edit_site_tabs' ) )
network_edit_site_tabs( $id );
?>
</h3>
</div>
<?php
} |
bueltge
added a commit
that referenced
this issue
Nov 24, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am not sure how we should approach this.
An idea:
$tabs
array (like$menu
)function add_page_tab
(naming to be discussed) similar tofunction add_menu_page
->
tabs.php
similar tonetwork/menu.php
to output the tabs on pagesThat's all I got for now. I am not too familiar with core development so please tell me if my idea a possible abstract idea or totally not the way to go.
Current $tabs array from
network/site-info.php
:We could aim for it to be used "everywhere" to output tabs. Something I wanted for so long
The text was updated successfully, but these errors were encountered: