Edit File by line
/home/zeestwma/ceyloniy.../wp-inclu.../blocks
File: comment-edit-link.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/comment-edit-link` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/comment-edit-link` block on the server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 6.0.0
[10] Fix | Delete
*
[11] Fix | Delete
* @param array $attributes Block attributes.
[12] Fix | Delete
* @param string $content Block default content.
[13] Fix | Delete
* @param WP_Block $block Block instance.
[14] Fix | Delete
*
[15] Fix | Delete
* @return string Return the post comment's date.
[16] Fix | Delete
*/
[17] Fix | Delete
function render_block_core_comment_edit_link( $attributes, $content, $block ) {
[18] Fix | Delete
if ( ! isset( $block->context['commentId'] ) || ! current_user_can( 'edit_comment', $block->context['commentId'] ) ) {
[19] Fix | Delete
return '';
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
$edit_comment_link = get_edit_comment_link( $block->context['commentId'] );
[23] Fix | Delete
[24] Fix | Delete
$link_atts = '';
[25] Fix | Delete
[26] Fix | Delete
if ( ! empty( $attributes['linkTarget'] ) ) {
[27] Fix | Delete
$link_atts .= sprintf( 'target="%s"', esc_attr( $attributes['linkTarget'] ) );
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
$classes = array();
[31] Fix | Delete
if ( isset( $attributes['textAlign'] ) ) {
[32] Fix | Delete
$classes[] = 'has-text-align-' . $attributes['textAlign'];
[33] Fix | Delete
}
[34] Fix | Delete
if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
[35] Fix | Delete
$classes[] = 'has-link-color';
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
[39] Fix | Delete
[40] Fix | Delete
return sprintf(
[41] Fix | Delete
'<div %1$s><a href="%2$s" %3$s>%4$s</a></div>',
[42] Fix | Delete
$wrapper_attributes,
[43] Fix | Delete
esc_url( $edit_comment_link ),
[44] Fix | Delete
$link_atts,
[45] Fix | Delete
esc_html__( 'Edit' )
[46] Fix | Delete
);
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* Registers the `core/comment-edit-link` block on the server.
[51] Fix | Delete
*
[52] Fix | Delete
* @since 6.0.0
[53] Fix | Delete
*/
[54] Fix | Delete
function register_block_core_comment_edit_link() {
[55] Fix | Delete
register_block_type_from_metadata(
[56] Fix | Delete
__DIR__ . '/comment-edit-link',
[57] Fix | Delete
array(
[58] Fix | Delete
'render_callback' => 'render_block_core_comment_edit_link',
[59] Fix | Delete
)
[60] Fix | Delete
);
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
add_action( 'init', 'register_block_core_comment_edit_link' );
[64] Fix | Delete
[65] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function