Making WordPress.org


Ignore:
Timestamp:
08/21/2017 02:08:26 PM (9 years ago)
Author:
danielbachhuber
Message:

phpunit-test-reporter: Use full width template when available

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/phpunit-test-reporter/src/class-display.php

    r5823 r5826  
    1212        public static function action_init_register_shortcode() {
    1313                add_shortcode( 'ptr-results', array( __CLASS__, 'render_results' ) );
     14        }
     15
     16        /**
     17         * Use the full width template by default when available
     18         */
     19        public static function filter_get_post_metadata( $check, $object_id, $meta_key, $single ) {
     20                if ( 'result' !== get_post_type( $object_id )
     21                        || '_wp_page_template' !== $meta_key ) {
     22                        return $check;
     23                }
     24                $template = 'page-templates/full-width.php';
     25                $full_width = get_stylesheet_directory() . '/' . $template;
     26                if ( ! file_exists( $full_width ) ) {
     27                        return $check;
     28                }
     29                return $single ? $template : array( $template );
     30        }
     31
     32        /**
     33         * Filter body classes
     34         */
     35        public static function filter_body_class( $classes ) {
     36                if ( in_array( 'result-template-full-width', $classes, true ) ) {
     37                        $classes[] = 'page-template-full-width';
     38                }
     39                return $classes;
    1440        }
    1541
Note: See TracChangeset for help on using the changeset viewer.