From b333d1d515c7fe91ec063112a6c178d5ed66b1e4 Mon Sep 17 00:00:00 2001 From: Michael Burridge Date: Fri, 9 Dec 2022 20:48:11 +0000 Subject: [PATCH] Adds clarifications and clears up inaccuracies (#46283) * Adds clarifications and clears up inaccuracies * Add word: 'subsequently' * Fixes typo * Update docs/getting-started/create-block/attributes.md Co-authored-by: Ryan Welcher Co-authored-by: Ryan Welcher --- docs/getting-started/create-block/attributes.md | 2 +- docs/getting-started/create-block/block-anatomy.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/getting-started/create-block/attributes.md b/docs/getting-started/create-block/attributes.md index 5ec6f60c3d6a4..02a55f380dcee 100644 --- a/docs/getting-started/create-block/attributes.md +++ b/docs/getting-started/create-block/attributes.md @@ -23,7 +23,7 @@ Note: The text portion is equivalent to `innerText` attribute of a DOM element. ## Edit and Save -The **attributes** are passed to the `edit` and `save` functions, along with a **setAttributes** function to set the values. Additional parameters are also passed in to these functions, see [the edit/save documentation](/docs/reference-guides/block-api/block-edit-save.md) for more details. +The **attributes** are passed to both the `edit` and `save` functions. The **setAttributes** function is also passed, but only to the `edit` function. The **setAttributes** function is used to set the values. Additional parameters are also passed in to the `edit` and `save` functions, see [the edit/save documentation](/docs/reference-guides/block-api/block-edit-save.md) for more details. The `attributes` is a JavaScript object containing the values of each attribute, or default values if defined. The `setAttributes` is a function to update an attribute. diff --git a/docs/getting-started/create-block/block-anatomy.md b/docs/getting-started/create-block/block-anatomy.md index 3f43c018cea39..83dbcf1469632 100644 --- a/docs/getting-started/create-block/block-anatomy.md +++ b/docs/getting-started/create-block/block-anatomy.md @@ -29,7 +29,7 @@ registerBlockType( metadata.name, { } ); ``` -The first parameter in the **registerBlockType** function is the block name, this should match exactly to the name registered in the PHP file. +The first parameter in the **registerBlockType** function is the block name, this should match exactly to the `name` property in the `block.json` file. By importing the metadata from `block.json` and referencing the `name` property in the first parameter we ensure that they will match, and continue to match even if the name is subsequently changed in `block.json`. The second parameter to the function is the block object. See the [block registration documentation](/docs/reference-guides/block-api/block-registration.md) for full details. @@ -37,7 +37,7 @@ The last two block object properties are **edit** and **save**, these are the ke The results of the edit function is what the editor will render to the editor page when the block is inserted. -The results of the save function is what the editor will insert into the **post_content** field when the post is saved. The post_content field is the field in the WordPress database used to store the content of the post. +The results of the save function is what the editor will insert into the **post_content** field when the post is saved. The post_content field is the field in the **wp_posts** table in the WordPress database that is used to store the content of the post. Most of the properties are set in the `src/block.json` file.