Opened 7 years ago
Closed 7 years ago
#45109 closed task (blessed) (fixed)
Introduce editor block related functions
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.0 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Editor | Keywords: | fixed-5.0 |
| Focuses: | Cc: |
Description
The editor's block related functions are located in /lib/blocks.php of Gutenberg. These should exist in WordPress Core instead.
Attachments (1)
Change History (23)
#6
@
7 years ago
- Keywords fixed-5.0 added; needs-patch needs-unit-tests removed
There are still some issues (eg, GB#10463) to be tackled, but that can be done in a seperate ticket. This one is done for now.
#7
in reply to:
↑ 4
;
follow-up:
↓ 8
@
7 years ago
Replying to pento:
WP_Block_Parseris copied from the@wordpress/block-serialization-default-parserpackage. To ensure it stays in sync with the JavaScript parser, changes should be implemented in the package first, then the package version should be upgraded to include the changes.
What about @since tags? Do all three classes must be in the same file?
Also, in [43752] you probably included /blocks directory by mistake.
#8
in reply to:
↑ 7
@
7 years ago
Replying to dimadin:
What about
@sincetags? Do all three classes must be in the same file?
Because WP_Block_Parser comes from an external package, any @since tags are related to the package version, not the WordPress version. This is similar to other external packages, such as SimplePie, for example.
Also, in [43752] you probably included
/blocksdirectory by mistake.
/src/wp-includes/blocks? That's intentional, it contains the PHP needed to for the dynamic blocks that are included in Core. It's similar to the /src/wp-includes/widgets directory.
#9
@
7 years ago
@pento Please note that you forgot to remove the gutenberg text domain for all the strings in wp-includes/blocks. I fixed those and the package names in 45109.diff.
Also, not really happy with the gutenberg_ function prefixes there. Especially since a function like gutenberg_draft_or_post_title() can be used in lots of other places like Walker_PageDropdown::start_el(), wp_prepare_attachment_for_js(), WP_Widget_Recent_Posts::widget() or wp_ajax_find_posts(), perhaps even more.
#10
@
7 years ago
These are copied from @wordpress/block-library so need to be fixed in the Gutenberg repo.
I've opened an issue for removing the text domain.
I agree that there's still work to be done to clean up the naming here, we can reshuffle things a bit.
#11
@
7 years ago
@pento Did you consider loading the block-library php files directly from the npm packages instead of copying them over?
My concern with copying is that these are highly tied to their JavaScript part, so they should probably live together.
#12
@
7 years ago
@youknowriad: The files are copied from the npm package as part of the grunt webpack:dev script, they're intended to be maintained in the package, and copied into core when the package is upgraded.
#16
@
7 years ago
Why do gutenberg_render_block_core_latest_comments and gutenberg_draft_or_post_title still have the gutenberg_ prefix where other functions like render_block_core_latest_posts don't? That looks quite arbitrary.
#17
@
7 years ago
Thank you for the reminder, @swissspidy. I've added an issue in the Gutenberg repo to track that, too.
In 43742: