Nessuna descrizione

class-wp-block-editor-context.php 890B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * Blocks API: WP_Block_Editor_Context class
  4. *
  5. * @package WordPress
  6. * @since 5.8.0
  7. */
  8. /**
  9. * Class representing a current block editor context.
  10. *
  11. * The expectation is that block editor can have a different set
  12. * of requirements on every screen where it is used. This class
  13. * allows to define supporting settings that can be used with filters.
  14. *
  15. * @since 5.8.0
  16. */
  17. final class WP_Block_Editor_Context {
  18. /**
  19. * Post being edited. Optional.
  20. *
  21. * @since 5.8.0
  22. *
  23. * @var WP_Post|null
  24. */
  25. public $post = null;
  26. /**
  27. * Constructor.
  28. *
  29. * Populates optional properties for a given block editor context.
  30. *
  31. * @since 5.8.0
  32. *
  33. * @param array $settings The list of optional settings to expose in a given context.
  34. */
  35. public function __construct( array $settings = array() ) {
  36. if ( isset( $settings['post'] ) ) {
  37. $this->post = $settings['post'];
  38. }
  39. }
  40. }