-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugin: Update block editor settings to work with context (#32159)
* Plugin: Update block editor settings to work with context * Update block-editor.php
- Loading branch information
Showing
8 changed files
with
257 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
lib/compat/wordpress-5.8/class-wp-block-editor-context.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* Blocks API: WP_Block_Editor_Context class | ||
* | ||
* @package Gutenberg | ||
*/ | ||
|
||
/** | ||
* Class representing a current block editor context. | ||
* | ||
* The expectation is that block editor can have a different set | ||
* of requirements on every screen where it is used. This class | ||
* allows to define supporting settings that can be used with filters. | ||
*/ | ||
final class WP_Block_Editor_Context { | ||
/** | ||
* Post being edited. Optional. | ||
* | ||
* @var WP_Post|null | ||
*/ | ||
public $post = null; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* Populates optional properties for a given block editor context. | ||
* | ||
* @param array $settings The list of optional settings to expose in a given context. | ||
*/ | ||
public function __construct( array $settings = array() ) { | ||
if ( isset( $settings['post'] ) ) { | ||
$this->post = $settings['post']; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.