Make WordPress Core


Ignore:
Timestamp:
02/22/2018 12:24:00 AM (7 years ago)
Author:
pento
Message:

REST API: Show taxonomy visibility settings.

For Gutenberg and other admin-type interfaces, it's useful to be able to see the visibility settings for taxonomies.

Props joehoyle, pento.
Fixes #42707.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-taxonomies-controller.php

    r42343 r42729  
    192192            'hierarchical' => $taxonomy->hierarchical,
    193193            'rest_base'    => $base,
     194            'visibility'   => array(
     195                'public'             => (bool) $taxonomy->public,
     196                'publicly_queryable' => (bool) $taxonomy->publicly_queryable,
     197                'show_admin_column'  => (bool) $taxonomy->show_admin_column,
     198                'show_in_nav_menus'  => (bool) $taxonomy->show_in_nav_menus,
     199                'show_in_quick_edit' => (bool) $taxonomy->show_in_quick_edit,
     200                'show_ui'            => (bool) $taxonomy->show_ui,
     201            ),
    194202        );
    195203
     
    296304                    'readonly'    => true,
    297305                ),
     306                'visibility'   => array(
     307                    'description' => __( 'The visibility settings for the taxomonmy.' ),
     308                    'type'        => 'object',
     309                    'context'     => array( 'edit' ),
     310                    'readonly'    => true,
     311                    'properties'  => array(
     312                        'public'             => array(
     313                            'description' => 'Whether a taxonomy is intended for use publicly either via the admin interface or by front-end users.',
     314                            'type'        => 'boolean',
     315                        ),
     316                        'publicly_queryable' => array(
     317                            'description' => 'Whether the taxonomy is publicly queryable.',
     318                            'type'        => 'boolean',
     319                        ),
     320                        'show_ui'            => array(
     321                            'description' => 'Whether to generate a default UI for managing this taxonomy.',
     322                            'type'        => 'boolean',
     323                        ),
     324                        'show_admin_column'  => array(
     325                            'description' => 'Whether to allow automatic creation of taxonomy columns on associated post-types table.',
     326                            'type'        => 'boolean',
     327                        ),
     328                        'show_in_nav_menus'  => array(
     329                            'description' => 'Whether to make the taxonomy available for selection in navigation menus.',
     330                            'type'        => 'boolean',
     331                        ),
     332                        'show_in_quick_edit' => array(
     333                            'description' => 'Whether to show the taxonomy in the quick/bulk edit panel.',
     334                            'type'        => 'boolean',
     335                        ),
     336
     337                    ),
     338                ),
    298339            ),
    299340        );
Note: See TracChangeset for help on using the changeset viewer.