Opened 16 years ago
Closed 16 years ago
#9606 closed feature request (fixed)
screen_layout for plugins
Reported by: | arena | Owned by: | arena |
---|---|---|---|
Milestone: | 2.8 | Priority: | high |
Severity: | normal | Version: | 2.8 |
Component: | Administration | Keywords: | has-patch tested commit |
Focuses: | Cc: |
Description
In order to allow plugins to integrate this new wp feature !
function screen_layout($screen) { global $screen_layout_columns; switch ( $screen ) { case 'dashboard': $screen_layout_columns = get_user_option('screen_layout_dashboard'); $num = 4; break; case 'post': $screen_layout_columns = get_user_option('screen_layout_post'); $num = 2; break; case 'page': $screen_layout_columns = get_user_option('screen_layout_page'); $num = 2; break; case 'link': $screen_layout_columns = get_user_option('screen_layout_link'); $num = 2; break; default: $screen_layout_columns = 0; return ''; } // the following test is useless ! if ( ! $screen_layout_columns ) $screen_layout_columns = 2; $i = 1;
to be replaced by
function screen_layout($screen) { global $screen_layout_columns; $wp_screen_layouts = array('dashboard' => 4, 'post' => 2, 'page' => 2, 'link' => 2); $wp_screen_layouts = apply_filters('screen_layout', $wp_screen_layouts, $screen); if (!isset($wp_screen_layouts[$screen])) { $screen_layout_columns = 0; return ''; } $screen_layout_columns = get_user_option("screen_layout_$screen"); $num = $wp_screen_layouts[$screen]; $i = 1;
Attachments (2)
Change History (17)
#6
follow-up:
↓ 7
@
16 years ago
unless you build an editor for a different data type and write the needed scripts.
#7
in reply to:
↑ 6
;
follow-ups:
↓ 8
↓ 9
@
16 years ago
Replying to Denis-de-Bernardy:
unless you build an editor for a different data type and write the needed scripts.
In this case the page would be mostly copied from the write posts page? Can probably use the same columns setting too.
Actually the different settings for posts and pages should probably be merged too, don't see a used case where one would need 2 columns and the other only one as both screens are almost identical.
The patch also wouldn't work if the user_option is not set (the "useless" check does exactly that).
#8
in reply to:
↑ 7
@
16 years ago
Replying to azaozz:
Actually the different settings for posts and pages should probably be merged too, don't see a used case where one would need 2 columns and the other only one as both screens are almost identical.
it depends on his prefs. suppose a user sticks to the default layout on posts (which are short), and moves all of the widgets to the right into the middle column on pages, to have a wider editor.
#9
in reply to:
↑ 7
;
follow-up:
↓ 10
@
16 years ago
Replying to azaozz:
Replying to Denis-de-Bernardy:
unless you build an editor for a different data type and write the needed scripts.
In this case the page would be mostly copied from the write posts page? Can probably use the same columns setting too.
Actually the different settings for posts and pages should probably be merged too, don't see a used case where one would need 2 columns and the other only one as both screens are almost identical.
The patch also wouldn't work if the user_option is not set (the "useless" check does exactly that).
(the "useless" check does exactly that).
sorry if i follow the code, in the switch, if the $screen is not found => return
so in the test :
if ( ! $screen_layout_columns )
$screen_layout_columns is always true...
#10
in reply to:
↑ 9
@
16 years ago
Replying to arena:
$screen_layout_columns is always true...
Unless the $screen
is found but the option is not set. Then $screen_layout_columns = false
so it needs default value which is 2. See get_user_option()
#12
@
16 years ago
- Keywords needs-testing added; tested removed
Patch fixing the test if get_user_option not found
Some plugins have a design similar to the wordpress admin pages and relying on settings from other admin pages looks tricky !
This heavily depends on js and the actual html of the pages, don't think plugins would be able to use it other than disabling it when the user wants to switch number of columns. Don't think that's needed.