Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update attributes example: alter source children #41016

Merged
merged 2 commits into from
Jul 11, 2022
Merged

Update attributes example: alter source children #41016

merged 2 commits into from
Jul 11, 2022

Conversation

rflw
Copy link
Contributor

@rflw rflw commented May 12, 2022

What?

Update attributes guide https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/.

Why?

There's no children value mentioned for source in official reference https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source.

Available values are only:

– (no value) – when no source is specified then data is stored in the block’s comment delimiter.
– attribute – data is stored in an HTML element attribute.
– text – data is stored in HTML text.
– html – data is stored in HTML. This is typically used by RichText.
– query – data is stored as an array of objects.
– meta – data is stored in post meta (deprecated).

How?

All examples should be replaced by valid source value or attributes documentation should be updated to add children value as official.

Testing Instructions

  1. Open https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/introducing-attributes-and-editable-fields/
  2. Go to first code snippet
attributes: {
    content: {
        type: 'array',
        source: 'children',
        selector: 'p',
    },
},
  1. Compare source value with official documentation https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source
    There's no source: children mentioned.

Screenshots or screencast

image

`source: children` is not mentioned in attributes documentation<https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/#value-source/>  
It shouldn't be used in examples.  

Available source values are only: 

– (no value) – when no source is specified then data is stored in the block’s comment delimiter.
– attribute – data is stored in an HTML element attribute.
– text – data is stored in HTML text.
– html – data is stored in HTML. This is typically used by RichText.
– query – data is stored as an array of objects.
– meta – data is stored in post meta (deprecated).
@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label May 12, 2022
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @rflw! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@gziolo gziolo added [Feature] Block API API that allows to express the block paradigm. [Type] Developer Documentation Documentation for developers labels May 12, 2022
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing, @rflw.

The changes look good. I just left a small suggestion.

@Mamaduka Mamaduka requested a review from fabiankaegy as a code owner July 7, 2022 06:16
@gziolo gziolo merged commit 40cea6b into WordPress:trunk Jul 11, 2022
@github-actions
Copy link

Congratulations on your first merged pull request, @rflw! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 13.7 milestone Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants