Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.77k stars 891 forks source link

Implement cornerstone content checkmark connector #10302

Closed IreneStr closed 6 years ago

IreneStr commented 6 years ago

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:

  1. We'll update the hidden field.
  2. 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:

Needs https://github.com/Yoast/wordpress-seo/issues/10178 Needs https://github.com/Yoast/wordpress-seo/issues/10267

moorscode commented 6 years ago

The hidden field to use: yoast_wpseo_is_cornerstone