[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/blocks/ -> latest-posts.php (summary)

Server-side rendering of the `core/latest-posts` block.

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

Defines 4 functions

  block_core_latest_posts_get_excerpt_length()
  render_block_core_latest_posts()
  register_block_core_latest_posts()
  block_core_latest_posts_migrate_categories()

Functions
Functions that are not part of a class:

block_core_latest_posts_get_excerpt_length()   X-Ref
Callback for the excerpt_length filter used by
the Latest Posts block at render time.

return: int Returns the global $block_core_latest_posts_excerpt_length variable

render_block_core_latest_posts( $attributes )   X-Ref
Renders the `core/latest-posts` block on server.

return: string Returns the post content with latest posts added.
param: array $attributes The block attributes.

register_block_core_latest_posts()   X-Ref
Registers the `core/latest-posts` block on server.


block_core_latest_posts_migrate_categories( $block )   X-Ref
Handles outdated versions of the `core/latest-posts` block by converting
attribute `categories` from a numeric string to an array with key `id`.

This is done to accommodate the changes introduced in #20781 that sought to
add support for multiple categories to the block. However, given that this
block is dynamic, the usual provisions for block migration are insufficient,
as they only act when a block is loaded in the editor.

TODO: Remove when and if the bottom client-side deprecation for this block
is removed.

return: array The migrated block object.
param: array $block A single parsed block object.



Generated: Wed Nov 25 01:00:04 2020 Cross-referenced by PHPXref 0.7.1