Make WordPress Core

Changeset 44130 for trunk


Ignore:
Timestamp:
12/14/2018 01:07:11 AM (8 years ago)
Author:
pento
Message:

Block Editor: Add an is_block_editor() method to WP_Screen.

This method allows checking (or setting) whether the block editor is loading on the current screen.

Merges [43777] from the 5.0 branch to trunk.

See #45037.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/wp-admin/includes/class-wp-screen.php

    r44048 r44130  
    178178         */
    179179        private $_screen_settings;
     180
     181        /**
     182         * Whether the screen is using the block editor.
     183         *
     184         * @since 5.0.0
     185         * @var bool
     186         */
     187        public $is_block_editor = false;
    180188
    181189        /**
     
    414422
    415423        /**
     424         * Sets or returns whether the block editor is loading on the current screen.
     425         *
     426         * @since 5.0.0
     427         *
     428         * @param bool $set Optional. Sets whether the block editor is loading on the current screen or not.
     429         * @return bool True if the block editor is being loaded, false otherwise.
     430         */
     431        public function is_block_editor( $set = null ) {
     432                if ( $set !== null ) {
     433                        $this->is_block_editor = (bool) $set;
     434                }
     435
     436                return $this->is_block_editor;
     437        }
     438
     439        /**
    416440         * Sets the old string-based contextual help for the screen for backward compatibility.
    417441         *
Note: See TracChangeset for help on using the changeset viewer.