Add block bindings support: core/post-date:isLink#79167
Conversation
Enable block bindings for the `core/post-date` block's `isLink` attribute Editor-side, the Attributes panel was previously hidden entirely for `core/post-date` to prevent the `datetime` attribute from being bound to incompatible sources (WordPress#72712). Replaced that all-or-nothing block-level hiding with a per-attribute map so the panel can expose `isLink` while keeping `datetime` hidden (the latter remains managed through the block's variations). Resetting the panel now only clears the visible bindings, leaving the variation-managed `datetime` binding intact. Server-side, register `isLink` as a supported attribute through the `block_bindings_supported_attributes` filter. The block's existing render callback already wraps the date in a link based on `isLink`, so no render changes are needed.
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @JDeepD! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
Enable block bindings for the
core/post-dateblock'sisLinkattributeEditor-side, the Attributes panel was previously hidden entirely for
core/post-dateto prevent thedatetimeattribute from being bound to incompatible sources (#72712). Replaced that all-or-nothing block-level hiding with a per-attribute map so the panel can exposeisLinkwhile keepingdatetimehidden (the latter remains managed through the block's variations). Resetting the panel now only clears the visible bindings, leaving the variation-manageddatetimebinding intact.Server-side, register
isLinkas a supported attribute through theblock_bindings_supported_attributesfilter. Theblock's existing render callback already wraps the date in a link based on
isLink, so no render changes are needed.What?
Closes #78851 (See for the
core/post-dateblock)Enables block bindings for the
core/post-dateblock'sisLinkattribute. This block already supported binding itsdatetimeattribute; this PR addsisLinkand unhides the bindings "Attributes" panel for the block, while keepingdatetimeout of that panel.Why?
For
core/post-date,datetimewas already supported;isLinkis the remaining attribute on the audit list.The Attributes panel was previously hidden entirely for
core/post-date(#72712) to prevent itsdatetimeattribute from being bound to incompatible (non-date) sources, which would break the block. That all-or-nothing approach also prevented exposing any other attribute, likeisLink. This PR replaces it with a finer-grained mechanism soisLinkcan be exposed safely whiledatetimestays hidden.How?
Editor-side:
core/post-datefrom the panel'shasSupportblocklist so the Attributes panel renders for the block again.HIDDEN_BLOCK_BINDINGS_PANEL_ATTRIBUTESmap that keepsdatetimehidden from the panel (it remains managed through the block's variations, where it's safely bound tocore/post-data), while exposingisLink.resetAllso it only clears the visible bindings, leaving the variation-manageddatetimebinding intact.Server-side:
isLinkas a supported attribute via theblock_bindings_supported_attributesfilter. The block's existing render callback already wraps the date in a link based onisLink, so no render changes are needed.Testing Instructions
A binding source exposing a boolean field is needed to connect
isLink(it's a boolean attribute). The quickest way is to register a boolean post-meta field:isLinkbut does not list datetime.is_link_fieldcustom field.npm run wp-env run cli wp post meta update <POST_ID> is_link_field 1npm run wp-env run cli wp post meta update <POST_ID> is_link_field 0Testing Instructions for Keyboard
Screenshots or screencast
Use of AI Tools