Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow contents of Paragraph to be "connected" to a meta custom field (#…
…53247) * Add custom fields experimental setting * Add connections experimental setting, block inspector control and block attributes * Add "connections" block attribute and get the meta field * Get rid of a phpcs warning * Update attribute acces and source definition Changed the attribute access from `$block_type->attributes` to `$block['attrs']`. Also updated attribute 'source' value from 'meta' to 'meta_fields'. These changes have been applied in both `blocks.php` and block attributes declaration in `block.json`. * Updated the 'connections' property to include 'attributes' * Add `attributes` to TextControl value * Add `attributes` to TextControl value * Wrap the PHP code in experimental flag * Update parens * Return early if there is no support for connections * Updated block type checks Rearranged the block type checks. Now, the code first checks if a given block is in the accepted types list (Paragraph and Image) and then it checks if the block type is null. This is a slight revamp of the existing checks for block support and block type acceptance. * Updated experimental blocks logic - Removed unused test functions. - Update the comment above the tag name query in the `custom-sources` to clarify future improvements for supporting more block types. * Add a comment in meta.php * Update comment * Clear the paragraph if meta value is cleared * Use placeholders instead of content * Update names of HTML processor instances in meta.php * Add extra comments * Rephrase the placeholder comment * Check if current block is a paragraph or image * Abstract the attribute name to use for the connection * rename `connections` to `__experimentalConnections` * Do not export `addAttribute()` or `withInspectorControl()` * Renamed '__experimentalConnections' to 'connections' in block settings * Renamed '__experimentalConnections' to 'connections' in block settings * Remove `connections` attribute from block.json * Renamed '__experimentalConnections' to 'connections' in block settings * Remove `get_updated_html() . ''` in meta.php * Add an allowlist of blocks/attributes * Refactor blocks.php & custom sources - Separate the "connections" into own file. - Move the code that renders the HTML using the meta fields back into blocks.php * Remove trailing comma? * Update naming: - "custom sources" -> connection sources - use "block connections" consistently --------- Co-authored-by: Carlos Bravo <[email protected]>
- Loading branch information