Make WordPress Core

Changeset 12993


Ignore:
Timestamp:
02/06/2010 05:27:30 PM (15 years ago)
Author:
ryan
Message:

Add a separate show_ui flag for post types. see #9674

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r12927 r12993  
    2121}
    2222
    23 if ( isset($_GET['post_type']) && ( in_array( $_GET['post_type'], get_post_types( array('_show' => true ) ) ) || in_array( $_GET['post_type'], get_post_types( array('_builtin' => true ) ) ) ) )
     23if ( isset($_GET['post_type']) && ( in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) ) )
    2424    $post_type = $_GET['post_type'];
    2525else
  • trunk/wp-admin/menu.php

    r12984 r12993  
    8282$_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
    8383
    84 foreach ( (array) get_post_types( array('_show' => true) ) as $ptype ) {
     84foreach ( (array) get_post_types( array('show_ui' => true) ) as $ptype ) {
    8585    $_wp_last_object_menu++;
    8686    $ptype_obj = get_post_type_object($ptype);
    87     $menu[$_wp_last_object_menu] = array(esc_attr($ptype_obj->label), 'edit_' . $ptype_obj->capability_type . 's', "edit.php?post_type=$ptype", '', 'menu-top', 'menu-posts', 'div');
     87    $menu[$_wp_last_object_menu] = array(esc_attr($ptype_obj->label), $ptype_obj->edit_type_cap, "edit.php?post_type=$ptype", '', 'menu-top', 'menu-posts', 'div');
    8888    $submenu["edit.php?post_type=$ptype"][5]  = array( __('Edit'), 'edit_posts',  "edit.php?post_type=$ptype");
    8989    /* translators: add new custom post type */
  • trunk/wp-admin/post-new.php

    r12987 r12993  
    1010require_once('admin.php');
    1111
    12 if ( isset($_GET['post_type']) && ( in_array( $_GET['post_type'], get_post_types( array('_show' => true ) ) ) || in_array( $_GET['post_type'], get_post_types( array('_builtin' => true ) ) ) ) )
     12if ( isset($_GET['post_type']) && ( in_array( $_GET['post_type'], get_post_types( array('public' => true ) ) ) ) )
    1313    $post_type = $_GET['post_type'];
    1414else
  • trunk/wp-includes/post.php

    r12992 r12993  
    1717function create_initial_post_types() {
    1818    register_post_type( 'post', array(  'label' => __('Posts'),
    19                                         'publicly_queryable' => true,
    20                                         'exclude_from_search' => false,
     19                                        'public' => true,
     20                                        'show_ui' => false,
    2121                                        '_builtin' => true,
    2222                                        '_edit_link' => 'post.php?post=%d',
     
    2929
    3030    register_post_type( 'page', array(  'label' => __('Pages'),
    31                                         'publicly_queryable' => true,
    32                                         'exclude_from_search' => false,
     31                                        'public' => true,
     32                                        'show_ui' => false,
    3333                                        '_builtin' => true,
    3434                                        '_edit_link' => 'post.php?post=%d',
     
    4141
    4242    register_post_type( 'attachment', array('label' => __('Media'),
    43                                             'exclude_from_search' => false,
     43                                            'public' => true,
     44                                            'show_ui' => false,
    4445                                            '_builtin' => true,
    4546                                            '_edit_link' => 'media.php?attachment_id=%d',
     
    5152
    5253    register_post_type( 'revision', array(  'label' => __('Revisions'),
    53                                             'exclude_from_search' => true,
     54                                            'public' => false,
    5455                                            '_builtin' => true,
    5556                                            '_edit_link' => 'revision.php?revision=%d',
     
    705706 * exclude_from_search - Whether to exclude posts with this post type from search results. Defaults to true if the type is not public, false if the type is public.
    706707 * publicly_queryable - Whether post_type queries can be performed from the front page.  Defaults to whatever public is set as.
     708 * show_ui - Whether to generate a default UI for managing this post type. Defaults to true if the type is public, false if the type is not public.
    707709 * inherit_type - The post type from which to inherit the edit link and capability type. Defaults to none.
    708710 * capability_type - The post type to use for checking read, edit, and delete capabilities. Defaults to "post".
     
    733735
    734736    // Args prefixed with an underscore are reserved for internal use.
    735     $defaults = array('label' => false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, '_show' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array() );
     737    $defaults = array('label' => false, 'publicly_queryable' => null, 'exclude_from_search' => null, '_builtin' => false, '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'public' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array(), 'register_meta_box_cb' => null, 'taxonomies' => array(), 'show_ui' => null );
    736738    $args = wp_parse_args($args, $defaults);
    737739    $args = (object) $args;
     
    743745    if ( null === $args->publicly_queryable )
    744746        $args->publicly_queryable = $args->public;
     747
     748    // If not set, default to the setting for public.
     749    if ( null === $args->show_ui )
     750        $args->show_ui = $args->public;
    745751
    746752    // If not set, default to true if not public, false if public.
     
    765771    if ( empty($args->delete_cap) )
    766772        $args->delete_cap = 'delete_' . $args->capability_type;
    767 
    768     if ( !$args->_builtin && $args->public )
    769         $args->_show = true;
    770773
    771774    if ( ! empty($args->supports) ) {
Note: See TracChangeset for help on using the changeset viewer.