[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/blocks/ -> comments.php (summary)

Server-side rendering of the `core/comments` block.

File Size: 227 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 5 functions

  render_block_core_comments()
  register_block_core_comments()
  comments_block_form_defaults()
  enqueue_legacy_post_comments_block_styles()
  register_legacy_post_comments_block()

Functions
Functions that are not part of a class:

render_block_core_comments( $attributes, $content, $block )   X-Ref
Renders the `core/comments` block on the server.

This render callback is mainly for rendering a dynamic, legacy version of
this block (the old `core/post-comments`). It uses the `comments_template()`
function to generate the output, in the same way as classic PHP themes.

As this callback will always run during SSR, first we need to check whether
the block is in legacy mode. If not, the HTML generated in the editor is
returned instead.

return: string Returns the filtered post comments for the current post wrapped inside "p" tags.
param: array    $attributes Block attributes.
param: string   $content    Block default content.
param: WP_Block $block      Block instance.

register_block_core_comments()   X-Ref
Registers the `core/comments` block on the server.


comments_block_form_defaults( $fields )   X-Ref
Use the button block classes for the form-submit button.

return: array Returns the modified fields.
param: array $fields The default comment form arguments.

enqueue_legacy_post_comments_block_styles( $block_name )   X-Ref
Enqueues styles from the legacy `core/post-comments` block. These styles are
required only by the block's fallback.

param: string $block_name Name of the new block type.

register_legacy_post_comments_block()   X-Ref
Ensures backwards compatibility for any users running the Gutenberg plugin
who have used Post Comments before it was merged into Comments Query Loop.

The same approach was followed when core/query-loop was renamed to
core/post-template.




Generated : Sat Dec 21 08:20:01 2024 Cross-referenced by PHPXref