nse object on success, or WP_Error object on failure.
*/
public function get_item( $request ) {
global $post;
$post_id = isset( $request['post_id'] ) ? (int) $request['post_id'] : 0;
if ( $post_id > 0 ) {
$post = get_post( $post_id );
// Set up postdata since this will be needed if post_id was set.
setup_postdata( $post );
}
$registry = WP_Block_Type_Registry::get_instance();
$registered = $registry->get_registered( $request['name'] );
if ( null === $registered || ! $registered->is_dynamic() ) {
return new WP_Error(
'block_invalid',
__( 'Invalid block.' ),
array(
'status' => 404,
)
);
}
$attributes = $request->get_param( 'attributes' );
// Create an array representation simulating the output of parse_blocks.
$block = array(
'blockName' => $request['name'],
'attrs' => $attributes,
'innerHTML' => '',
'innerContent' => array(),
);
// Render using render_block to ensure all relevant filters are used.
$data = array(
'rendered' => render_block( $block ),
);
return rest_ensure_response( $data );
}
/**
* Retrieves block's output schema, conforming to JSON Schema.
*
* @since 5.0.0
*
* @return array Item schema data.
*/
public function get_item_schema() {
if ( $this->schema ) {
return $this->schema;
}
$this->schema = array(
'$schema' => 'http://json-schema.org/schema#',
'title' => 'rendered-block',
'type' => 'object',
'properties' => array(
'rendered' => array(
'description' => __( 'The rendered block.' ),
'type' => 'string',
'required' => true,
'context' => array( 'edit' ),
),
),
);
return $this->schema;
}
}
Fatal error: require_once(): Failed opening required '/var/www/html/helitower.com.br/web/wp-includes/blocks/tag-cloud.php' (include_path='.:/usr/share/pear') in /var/www/html/helitower.com.br/web/wp-includes/blocks/require-dynamic-blocks.php on line 65
Fatal error: Uncaught Error: Call to a member function set() on null in /var/www/html/helitower.com.br/web/wp-includes/l10n.php:854
Stack trace:
#0 /var/www/html/helitower.com.br/web/wp-includes/l10n.php(957): load_textdomain('default', '/var/www/html/h...', 'pt_BR')
#1 /var/www/html/helitower.com.br/web/wp-includes/class-wp-fatal-error-handler.php(49): load_default_textdomain()
#2 [internal function]: WP_Fatal_Error_Handler->handle()
#3 {main}
thrown in /var/www/html/helitower.com.br/web/wp-includes/l10n.php on line 854