You can’t do that with PHP. You must use Javascript-React to alter/enhance block editor behaviour.
You’ll have to use subscribe function, for subscribing to actions, catch isSavingPost action there (there is also isAutoSavingPost for autosaves) and dispatch a Notice in the editor with appropriate action. Familiarity with React and Redux would be of great help.
Related Posts:
- How can I add a custom button to the post editor?
- Can we write custom DOM manipulation inside edit.js file while developing custom Gutenberg block?
- check if Gutenberg is currently in use
- How to use PanelColorSettings in custom Gutenberg block?
- Adding pre-publish checks with Gutenberg
- Managing two editable fields in gutenberg
- How to make repeated component/block in Gutenberg
- How to save block attributes when the output doesn’t change
- How to remove unwanted panels inside InspectorControls from core blocks in Gutenberg
- Gutenberg ServerSideRender is deprecated, how to work with new wp.serverSideRender component?
- How to get data from WordPress $wpdb into React Gutenberg Blocks Frontend?
- lodash dependency in a Gutenberg plugin
- creating elements/innerblocks via rangecontrol
- What’s the Right Way to get and save remote data for a Gutenberg block?
- How to Parse an Array of Elements in Gutenberg Block
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- Using the component outside the editor. select(‘core’) is null
- Gutenberg is there a way to know if the current block is reusable?
- How to disable “Transform to” option in Gutenberg custom blocks
- How to allow core Gutenberg blocks selection only when you are inside a custom inner block
- WYSIWYG editor in WP 3.2 plugin
- Saving data from block editor to the database
- Make a list with header and subtext in Gutenberg blocks
- Gutenberg – What is the best way to save/update post meta?
- Add notification bubble notice in navigation using transients
- Getting admin notices working for plugin errors
- Add a panel to edit post
- How insert negative values in Gutenberg box-control
- Initial help with official “create a block” tutorial
- the_editor() function
- Are block templates incompatible with serialize_blocks?
- How do I dynamically render an InnerBlock inside a dynamic block?
- ServerSideRender and Media Object: attributes passing image data object to php renderer even though it’s not set
- Gutenberg Block showing invalid content on edit
- Gutenberg blocks not getting styled on back end
- Run code once when block is created
- Best way to save custom css for an block
- How can I listen to events in Gutenberg block?
- It’s possible to passing a ref to FormTokenField from parent component using forwardRef?
- What’s the right way to instantiate new blocks and/or the plugin itself in toto when using wppb architecture?
- WP Gutenberg Blocks – How to limit first/root blocks
- Creating a custom Gutenberg block with columns
- JSX in WordPress Plugin Development
- ResizableBox with RangeControl not working
- Gutenberg: import dependency or assign from global variable?
- Gutenberg table block with Bootstrap .table class
- How to add a gradient component to a custom block
- How to add custom table style for table block in gutenberg editor
- Catching Gutenberg sidebar switch event
- Use npm and wp-env to make production bundle
- How to add template colors to custom block options in WordPress Gutenberg editor sidebar?
- How to use apiFetch to get author information in Gutenberg properly?
- Gutenberg blocks error: Each child in a list should have a unique “key” prop
- How to properly package a block plugin
- Setting global block attribute value
- Gutenberg – is it ok to load dependencies multiple times?
- Preventing double loading JS scripts (like React) when developing for Gutenberg
- how to display a string in admin_notices hook from a class plugin
- Modify custom block plugin without losing content
- Custom Block Not Shown in Block Inserter
- How to override supports of innerBlocks?
- var(–text-color) in style.scss works once but not twitch
- When setting styles to an extended block that was saved as a pattern, it doesn’t remove the style that was there
- Gutenberg block breaks when showing new data
- What happens/fires when you select a block in the editor?
- How to re-render inspector controls?
- Get value of custom checkbox from Gutenberg sidebar in plugin
- Where to save Gutenberg plugin data?
- Gutenberg component in a plugin admin
- Add custom html classes to gutenberg wrapper
- How to create save function for custom Gutenberg style block?
- Publish, Save Draft and Preview buttons do not work after being moved with jQuery
- Gutenberg and custom blocks messed up pagespeed score. What did I wrong?
- Gutenberg text field validation
- Custom plugin not appearing
- Gutenberg’s Popover component position relative to the focused element
- Undo operation not working in Rich text [Gutenberg]
- Gutenberg: – Call a function after Server Side Component is rendered
- Accept only PDF file for upload
- Help interpreting @wordpress/create-block-tutorial-template usage error
- How to replace content of a block in and re-render on change?
- extending a core block doesn’t work inside the editor
- Block Development: hamburger module throwing error in save function
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- Why isn’t custom sidebar panel not showing up in the Gutenberg Editor?
- REST API error in block editor for custom templates
- Reinitiate Gutenburg’s blocks using javascript
- Set srcset on a block image
- Javascript function defined in view.js not reachable from save.js
- How to move custom gutenberg block controls from settings to styles tab?
- How can I obtain an option (get_option) inside a block viewScript?
- WordPress 6.6.1 – Trying to make a block but receive error, “! Cannot read property ‘then’ of undefined”
- Template locked block does not show appender
- move useState variable from edit.js to save.js. How do I do that?
- Access DOM Element in Gutenberg Block on WP Admin Post Edit Screen
- Custom Gutenberg Block ‘Stylized List’ – Incorrect Rendering and Looping of List Items
- Custom Gutenberg block with nested InnerBlocks renderAppender not displaying add button
- Attributes array not saving values
- WordPress Block with Interactivity API e Preact Component
- Insert Button in to the Block Editor (Header) Toolbar