WordPress.org

Making WordPress.org


Ignore:
Timestamp:
05/09/2019 08:25:34 PM (3 years ago)
Author:
coffee2code
Message:

Developer: Disable table of contents (aka "Topics") for the Block Editor handbook.

See #4388.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/import-block-editor.php

    r8725 r8765  
    1414
    1515        add_filter( 'handbook_label', array( $this, 'change_handbook_label' ), 10, 2 );
     16        add_filter( 'handbook_display_toc',            array( $this, 'disable_toc' ) );
    1617        add_filter( 'get_post_metadata',               array( $this, 'fix_markdown_source_meta' ), 10, 4 );
    1718        add_filter( 'wporg_markdown_before_transform', array( $this, 'wporg_markdown_before_transform' ),  10, 2 );
     
    4445
    4546        return $label;
     47    }
     48
     49    /**
     50     * Disables table of contents in-page widget for the Block Editor handbook.
     51     *
     52     * @param $display Should the table of contents be displayed?
     53     * @return bool
     54     */
     55    public function disable_toc( $display ) {
     56        if ( $this->get_post_type() === get_post_type() ) {
     57            $display = false;
     58        }
     59
     60        return $display;
    4661    }
    4762
Note: See TracChangeset for help on using the changeset viewer.