screen_layout

Definition:
function screen_layout($screen) {}

Parameters

  • $screen

Defined filters

  • screen_layout_columns
    apply_filters('screen_layout_columns', array()

Source code

function screen_layout($screen) {

	global $screen_layout_columns, $wp_current_screen_options;



	if ( is_string($screen) )

		$screen = convert_to_screen($screen);



	// Back compat for plugins using the filter instead of add_screen_option()

	$columns = apply_filters('screen_layout_columns', array(), $screen->id, $screen);

	if ( !empty($columns) && isset($columns[$screen->id]) )

		add_screen_option('layout_columns', array('max' => $columns[$screen->id]) );



	if ( !isset($wp_current_screen_options['layout_columns']) ) {

		$screen_layout_columns = 0;

		return '';

	}



	$screen_layout_columns = get_user_option("screen_layout_$screen->id");

	$num = $wp_current_screen_options['layout_columns']['max'];



	if ( ! $screen_layout_columns ) {

		if ( isset($wp_current_screen_options['layout_columns']['default']) )

			$screen_layout_columns = $wp_current_screen_options['layout_columns']['default'];

		else

			$screen_layout_columns = 2;

	}



	$i = 1;

	$return = '<h5>' . __('Screen Layout') . "</h5>\n<div class='columns-prefs'>" . __('Number of Columns:') . "\n";

	while ( $i <= $num ) {

		$return .= "<label><input type='radio' name='screen_columns' value='$i'" . ( ($screen_layout_columns == $i) ? " checked='checked'" : "" ) . " /> $i</label>\n";

		++$i;

	}

	$return .= "</div>\n";

	return $return;

}

2809

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: