Currently, the value of the checkbox in the metabox is directly saved to the database. Many of the other settings and inputs in the metabox are saved using hidden fields. In the first iteration of the Gutenberg sidebar, we're going to use these hidden fields to save settings/inputs from both the sidebar as well as the metabox to the database. ~Because there is no hidden field for the cornerstone checkmark yet, we need to implement it. (this is done in https://github.com/Yoast/wordpress-seo/pull/10365)~
The flow will be as follows: We register a store in Gutenberg and subscribe to that store. Everytime cornerstone is toggled/(un)checked in the sidebar or metabox, an action will be dispatched to update the state to reflect this state.
Everytime this happens, we'll do the following 2 things:
We'll update the hidden field.
We'll sync the two cornerstone inputs. If the cornerstone toggle in the sidebar is toggled 'on', the cornerstone checkmark in the metabox should be checked as well, and vice versa.
Additional notes:
On initial load, the cornerstone hidden field should be read to set the state.
The cornerstone flag is currently only shown on (custom)-post-types, not on Taxonomies.
For now, we should follow that functionality.
Context
In https://github.com/Yoast/wordpress-seo/issues/10178 the reactified cornerstone checkmark was implemented in the metabox. In https://github.com/Yoast/wordpress-seo/issues/10267, a cornerstone content toggle was implemented in the sidebar.
Currently, the value of the checkbox in the metabox is directly saved to the database. Many of the other settings and inputs in the metabox are saved using hidden fields. In the first iteration of the Gutenberg sidebar, we're going to use these hidden fields to save settings/inputs from both the sidebar as well as the metabox to the database. ~Because there is no hidden field for the cornerstone checkmark yet, we need to implement it. (this is done in https://github.com/Yoast/wordpress-seo/pull/10365)~
The flow will be as follows: We register a store in Gutenberg and subscribe to that store. Everytime cornerstone is toggled/(un)checked in the sidebar or metabox, an action will be dispatched to update the state to reflect this state.
Everytime this happens, we'll do the following 2 things:
Additional notes:
Needs https://github.com/Yoast/wordpress-seo/issues/10178 Needs https://github.com/Yoast/wordpress-seo/issues/10267