PHP 클래스 CommentArray, ProcessWire

Maintains an array of multiple Comment instances. Serves as the value referenced when a FieldtypeComment field is reference from a Page. ProcessWire 2.x Copyright (C) 2015 by Ryan Cramer This file licensed under Mozilla Public License v2.0 http://mozilla.org/MPL/2.0/ https://processwire.com
상속: extends PaginatedArray, implements WirePaginatable
파일 보기 프로젝트 열기: ryancramerdesign/ProcessWire 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$field Field object associated with this CommentArray
$numLimit integer May vary from count() when on the last page of a result set. As a result, paging routines should refer to their own itemsPerPage rather than count(). Applicable for paginated result sets. This number is not enforced for adding items to this CommentArray.
$numStart integer If this CommentArray is a partial representation of a larger set, this will contain the starting result number if previous results preceded it.
$numTotal integer Total number of comments, including those here and others that aren't, but may be here in pagination.
$page Page that owns these comments, required to use the renderForm() or getCommentForm() methods.

공개 메소드들

메소드 설명
getCommentForm ( array $options = [] ) : CommentForm Return instance of CommentForm object
getCommentList ( array $options = [] ) Return instance of CommentList object
getField ( ) Get the Field that these comments are on
getLimit ( ) : integer Get the imposed limit on number of comments.
getPage ( ) Get the page that these comments are on
getTotal ( ) : integer Get the total number of comments
isIdentical ( WireArray $items, boolean | integer $strict = true ) : boolean Is the given CommentArray identical to this one?
isValidItem ( $item ) Per the WireArray interface, is the item a Comment
makeNew ( )
render ( array $options = [] ) : string Provides the default rendering of a comment list, which may or may not be what you want
renderAll ( array $options = [] ) : string Render all comments and a comments form below it
renderForm ( array $options = [] ) : string Provides the default rendering of a comment form, which may or may not be what you want
renderStars ( boolean $showCount = false, array $options = [] ) : string Render combined star rating for all comments in this CommentsArray
setField ( Field $field ) Set the Field that these comments are on
setPage ( Page $page ) Set the page that these comments are on
stars ( boolean $allowPartial = true, boolean $getCount = false ) : integer | float | false | array Get an average of all star ratings for all comments in this CommentsArray

메소드 상세

getCommentForm() 공개 메소드

Return instance of CommentForm object
public getCommentForm ( array $options = [] ) : CommentForm
$options array
리턴 CommentForm

getCommentList() 공개 메소드

Return instance of CommentList object
public getCommentList ( array $options = [] )
$options array

getField() 공개 메소드

Get the Field that these comments are on
public getField ( )

getLimit() 공개 메소드

If no limit set, then return number of comments currently here. Used for pagination.
public getLimit ( ) : integer
리턴 integer

getPage() 공개 메소드

Get the page that these comments are on
public getPage ( )

getTotal() 공개 메소드

Used for pagination.
public getTotal ( ) : integer
리턴 integer

isIdentical() 공개 메소드

Is the given CommentArray identical to this one?
public isIdentical ( WireArray $items, boolean | integer $strict = true ) : boolean
$items WireArray
$strict boolean | integer
리턴 boolean

isValidItem() 공개 메소드

Per the WireArray interface, is the item a Comment
public isValidItem ( $item )

makeNew() 공개 메소드

public makeNew ( )

render() 공개 메소드

Provides the default rendering of a comment list, which may or may not be what you want
또한 보기: CommentList class and override it to serve your needs
public render ( array $options = [] ) : string
$options array
리턴 string

renderAll() 공개 메소드

Render all comments and a comments form below it
public renderAll ( array $options = [] ) : string
$options array
리턴 string

renderForm() 공개 메소드

Provides the default rendering of a comment form, which may or may not be what you want
또한 보기: CommentForm class and override it to serve your needs
public renderForm ( array $options = [] ) : string
$options array
리턴 string

renderStars() 공개 메소드

Render combined star rating for all comments in this CommentsArray
public renderStars ( boolean $showCount = false, array $options = [] ) : string
$showCount boolean Specify true to include how many ratings the average is based on
$options array Overrides of stars and/or count, see $defaults in method
리턴 string

setField() 공개 메소드

Set the Field that these comments are on
public setField ( Field $field )
$field Field

setPage() 공개 메소드

Set the page that these comments are on
public setPage ( Page $page )
$page Page

stars() 공개 메소드

Get an average of all star ratings for all comments in this CommentsArray
public stars ( boolean $allowPartial = true, boolean $getCount = false ) : integer | float | false | array
$allowPartial boolean Allow partial stars? If true, returns a float. If false, returns int.
$getCount boolean If true, this method returns an array(stars, count) where count is number of ratings.
리턴 integer | float | false | array Returns false for stars value if no ratings yet.

프로퍼티 상세

$field 보호되어 있는 프로퍼티

Field object associated with this CommentArray
protected $field

$numLimit 보호되어 있는 프로퍼티

May vary from count() when on the last page of a result set. As a result, paging routines should refer to their own itemsPerPage rather than count(). Applicable for paginated result sets. This number is not enforced for adding items to this CommentArray.
protected int $numLimit
리턴 integer

$numStart 보호되어 있는 프로퍼티

If this CommentArray is a partial representation of a larger set, this will contain the starting result number if previous results preceded it.
protected int $numStart
리턴 integer

$numTotal 보호되어 있는 프로퍼티

Total number of comments, including those here and others that aren't, but may be here in pagination.
protected int $numTotal
리턴 integer

$page 보호되어 있는 프로퍼티

Page that owns these comments, required to use the renderForm() or getCommentForm() methods.
protected $page