pfeifferNet

Comment
in package

Comment functionality.

Customises comment form by using standard hooks to alter values.

Tags
since
1.0.0
since
5.5.0

Inherit standard singleton class.

since
5.7.0

Leverage global styles.

since
5.8.0

Make consistent with pNet forms handling.

since
5.11.0

Deprecated global singleton.

since
5.12.0

Refactor form rows for CSS selection.

since
6.0.0

Refactor for new UI.

Table of Contents

Constants

COMMENT_AUTHOR  = 'comment-author.php'
The partial containing markup for the comment author.
COMMENT_AUTHOR_EMAIL  = 'comment-author-email.php'
The partial containing markup for the comment author email.
COMMENT_COOKIES_CONSENT  = 'comment-cookies-consent.php'
The partial containing markup for the comment cookies consent.
COMMENT_FIELD  = 'comment-field.php'
The partial containing markup for the comment field.
COMMENT_HEADER  = 'comment-header.php'
The partial containg the comment form header markup.
SUBMIT_BUTTON  = 'comment-submit-button.php'
The partial containing markup for the submit button.
SUBMIT_FIELD  = 'comment-submit-field.php'
The partial containing markup for the wrapper around the submit button and hidden fields.

Properties

$comment_author  : string
The fully qualified path to the comment author partial.
$comment_author_email  : string
The fully qualified path to the comment author email partial.
$comment_cookies_consent  : string
The fully qualified path to the comment cookies consent partial.
$comment_field  : string
The fully qualified path to the comment field partial.
$comment_header  : string
The fully qualified path to the form header partial.
$instances  : array<string|int, object>
The array of instances of this class and sub-classes.
$progress_container  : string
The progress indicator container markup.
$require_name_email  : bool
Required field flag.
$submit_button  : string
The fully qualified path to the submit button partial.
$submit_field  : string
The fully qualified path to the submit button wrapper partial.

Methods

get_instance()  : object
Creates and/or returns the instance of this class.
render_form_top()  : void
Add markup to beginning of comment form for progress indicator container.
set_cancel_reply_link()  : string
Edit link markup for cancel comment reply.
set_date_link()  : bool
Remove the link on comment date.
set_form()  : array<string|int, mixed>
Comment form customisation.
set_reply_link()  : string
Edit link markup for comment reply.
set_reply_link_args()  : array<string|int, mixed>
Filter the comment reply link arguments.
__construct()  : void
Initialise the class.

Constants

COMMENT_AUTHOR

The partial containing markup for the comment author.

protected string COMMENT_AUTHOR = 'comment-author.php'
Tags
since
5.8.0

COMMENT_AUTHOR_EMAIL

The partial containing markup for the comment author email.

protected string COMMENT_AUTHOR_EMAIL = 'comment-author-email.php'
Tags
since
5.8.0

The partial containing markup for the comment cookies consent.

protected string COMMENT_COOKIES_CONSENT = 'comment-cookies-consent.php'
Tags
since
5.8.0

COMMENT_FIELD

The partial containing markup for the comment field.

protected string COMMENT_FIELD = 'comment-field.php'
Tags
since
5.8.0

COMMENT_HEADER

The partial containg the comment form header markup.

protected string COMMENT_HEADER = 'comment-header.php'
Tags
since
6.0.0

SUBMIT_BUTTON

The partial containing markup for the submit button.

protected string SUBMIT_BUTTON = 'comment-submit-button.php'
Tags
since
6.0.0

SUBMIT_FIELD

The partial containing markup for the wrapper around the submit button and hidden fields.

protected string SUBMIT_FIELD = 'comment-submit-field.php'
Tags
since
5.8.0

Properties

$comment_author

The fully qualified path to the comment author partial.

protected string $comment_author = ''
Tags
since
5.8.0

$comment_author_email

The fully qualified path to the comment author email partial.

protected string $comment_author_email = ''
Tags
since
5.8.0

The fully qualified path to the comment cookies consent partial.

protected string $comment_cookies_consent = ''
Tags
since
5.8.0

$comment_field

The fully qualified path to the comment field partial.

protected string $comment_field = ''
Tags
since
5.8.0

$comment_header

The fully qualified path to the form header partial.

protected string $comment_header = ''
Tags
since
6.0.0

$instances

The array of instances of this class and sub-classes.

protected static array<string|int, object> $instances = array()
Tags
since
5.11.0

$progress_container

The progress indicator container markup.

protected string $progress_container = ''
Tags
since
6.0.0

$require_name_email

Required field flag.

protected bool $require_name_email = true
Tags
since
1.4.0

$submit_button

The fully qualified path to the submit button partial.

protected string $submit_button = ''
Tags
since
6.0.0

$submit_field

The fully qualified path to the submit button wrapper partial.

protected string $submit_field = ''
Tags
since
5.8.0

Methods

get_instance()

Creates and/or returns the instance of this class.

public static get_instance() : object
Tags
since
5.11.0
Return values
object

The instance of this class.

Edit link markup for cancel comment reply.

public set_cancel_reply_link(string $cancel_comment_reply_link, string $link_url, string $link_text) : string

This adds the required button classes to the link.

Parameters
$cancel_comment_reply_link : string

The HTML-formatted cancel comment reply link.

$link_url : string

Cancel comment reply link URL.

$link_text : string

Cancel comment reply link text.

Tags
since
6.0.0
link
https://developer.wordpress.org/reference/hooks/cancel_comment_reply_link/
Return values
string

The changed link.

Remove the link on comment date.

public set_date_link() : bool
Tags
since
6.0.0
Return values
bool

The set links flag (false).

set_form()

Comment form customisation.

public set_form(array<string|int, mixed> $defaults) : array<string|int, mixed>

This sets to properties of the standard WordPress comment form. It leverages the standard pNet form handling and styles.

Parameters
$defaults : array<string|int, mixed>

Default comment form fields.

Tags
since
1.0.0
since
5.8.0

Replaced hard-coded markup with partials.

link
https://developer.wordpress.org/reference/hooks/comment_form_defaults/
Return values
array<string|int, mixed>

The modified form and fields settings.

Edit link markup for comment reply.

public set_reply_link(string $comment_reply_link, array<string|int, mixed> $args, WP_Comment $comment, WP_Post $post) : string

This adds the required button classes to the link.

Parameters
$comment_reply_link : string

The HTML markup for the comment reply link.

$args : array<string|int, mixed>

An array of arguments overriding the defaults.

$comment : WP_Comment

Comment being replied to. Default current comment.

$post : WP_Post

The post that the comment is going to be displayed on.

Tags
since
6.0.0
link
https://developer.wordpress.org/reference/hooks/comment_reply_link/
Return values
string

The changed link.

Filter the comment reply link arguments.

public set_reply_link_args(array<string|int, mixed> $args, WP_Comment $comment, WP_Post $post) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Default reply links arguments.

$comment : WP_Comment

Comment being replied to. Default current comment.

$post : WP_Post

The post that the comment is going to be displayed on.

Tags
since
6.0.0
link
https://developer.wordpress.org/reference/hooks/comment_reply_link_args/
Return values
array<string|int, mixed>

The modified comment args.


        
On this page

Search results