Version: current

# Class PageCommentInterface

Represents an interface for viewing and adding page comments Create one, passing the page discussed to the constructor. It can then be inserted into a template.

  Object
  ViewableData implements IteratorAggregate
  RequestHandler
  PageCommentInterface

Package: cms\comments
Located at cms/code/sitefeatures/PageCommentInterface.php

## Methods summary

`public` | # `__construct( `PageCommentInterface::$controller` $controller, `PageCommentInterface::$methodName` $methodName, `PageCommentInterface::$page` $page )` Create a new page comment interface Create a new page comment interface #### Parameters $controller controller The controller that the interface is used on $methodName methodName The method to return this PageCommentInterface object $page page The page that we're commenting on #### Overrides `RequestHandler::__construct`
`public` | # `Link( )`
`public static` | # `set_comments_require_login( boolean $state )` See `PageCommentInterface::$comments_require_login` See `PageCommentInterface::$comments_require_login` #### Parameters $state boolean state The new state of this static field
`public static` | # `set_comments_require_permission( string $permission )` See `PageCommentInterface::$comments_require_permission` See `PageCommentInterface::$comments_require_permission` #### Parameters $permission string permission The permission to check against.
`public static` | # `set_show_comments_when_disabled( boolean $state )` See `PageCommentInterface::$show_comments_when_disabled` See `PageCommentInterface::$show_comments_when_disabled` #### Parameters $state bool - show / hide the existing comments when disabled
`public static` | # `set_order_comments_by( String $order )` See `PageCommentInterface::$order_comments_by` See `PageCommentInterface::$order_comments_by` #### Parameters $order String
`public static` | # `set_use_ajax_commenting( boolean $state )` See `PageCommentInterface::$use_ajax_commenting` See `PageCommentInterface::$use_ajax_commenting` #### Parameters $state bool
`public` | # `forTemplate( )`
`public static boolean` | # `CanPostComment( )` #### Returns `boolean` true if the currently logged in user can post a comment, false if they can't. Users can post comments by default, enforce security by using #### Link PageCommentInterface::set_comments_require_login() and {PageCommentInterface::set_comments_require_permission()}.
`public boolean` | # `PostingRequiresPermission( )` if this page comment form requires users to have a valid permission code in order to post (used to customize the error message). if this page comment form requires users to have a valid permission code in order to post (used to customize the error message). #### Returns `boolean` bool
`public` | # `Page( )`
`public` | # `PostCommentForm( )`
`public` | # `Comments( )`
`public` | # `CommentRssLink( )`
`public` | # `DeleteAllLink( )` A link to PageComment_Controller.deleteallcomments() which deletes all comments on a page referenced by the url param pageid A link to PageComment_Controller.deleteallcomments() which deletes all comments on a page referenced by the url param pageid

### Methods inherited from RequestHandler

`allowedActions()`, `checkAccessAction()`, `getRequest()`, `handleRequest()`, `hasAction()`, `httpError()`

### Methods inherited from ViewableData

`ATT_val()`, `BaseHref()`, `CSSClasses()`, `ColumnBreak()`, `ColumnCalc()`, `ColumnNumber()`, `ColumnPad()`, `ColumnPos()`, `CurrentMember()`, `CurrentPage()`, `Debug()`, `Even()`, `EvenOdd()`, `First()`, `FirstLast()`, `HasPerm()`, `IsAjax()`, `JS_val()`, `Last()`, `Me()`, `Middle()`, `MiddleString()`, `Modulus()`, `MultipleOf()`, `Odd()`, `Pos()`, `RAW_val()`, `SQL_val()`, `ThemeDir()`, `ThemeName()`, `Top()`, `TotalItems()`, `XML_val()`, `__get()`, `__isset()`, `__set()`, `buildCastingCache()`, `cachedCall()`, `castingClass()`, `castingHelper()`, `castingHelperPair()`, `castingObjectCreator()`, `castingObjectCreatorPair()`, `customise()`, `defineMethods()`, `escapeTypeForField()`, `getField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `hasField()`, `hasValue()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`, `setField()`

### Methods inherited from Object

`__call()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `create()`, `createMethod()`, `create_from_string()`, `exists()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`public static array` | $url_handlers | # The default URL handling rules. This specifies that the next component of the URL corresponds to a method to be called on this RequestHandlingData object. The default URL handling rules. This specifies that the next component of the URL corresponds to a method to be called on this RequestHandlingData object. The keys of this array are parse rules. See `SS_HTTPRequest::match()` for a description of the rules available. The values of the array are the method to be called if the rule matches. If this value starts with a '$', then the named parameter of the parsed URL wil be used to determine the method name.
`public static array` | $allowed_actions | # Define a list of action handling methods that are allowed to be called directly by URLs. The variable should be an array of action names. This sample shows the different values that it can contain: Define a list of action handling methods that are allowed to be called directly by URLs. The variable should be an array of action names. This sample shows the different values that it can contain:
    array(
            'someaction', // someaction can be accessed by anyone, any time
            'otheraction' => true, // So can otheraction
            'restrictedaction' => 'ADMIN', // restrictedaction can only be people with ADMIN privilege
            'complexaction' '->canComplexAction' // complexaction can only be accessed if $this->canComplexAction() returns true
    );
`protected mixed` | $controller | #
`protected mixed` | $methodName | #
`protected mixed` | $page | #
`public static boolean` | $comments_require_login | # If this is true, you must be logged in to post a comment (and therefore, you don't need to specify a 'Your name' field unless your name is blank) If this is true, you must be logged in to post a comment (and therefore, you don't need to specify a 'Your name' field unless your name is blank)
`public static string` | $comments_require_permission | # If this is a valid permission code, you must be logged in and have the appropriate permission code on your account before you can post a comment. If this is a valid permission code, you must be logged in and have the appropriate permission code on your account before you can post a comment.
`public static boolean` | $use_ajax_commenting | # If this is true it will include the javascript for AJAX commenting. If it is set to false then it will not load the files required and it will fall back If this is true it will include the javascript for AJAX commenting. If it is set to false then it will not load the files required and it will fall back
`public static boolean` | $show_comments_when_disabled | # If this is true then we should show the existing comments on the page even when we have disabled the comment form. If this is true then we should show the existing comments on the page even when we have disabled the comment form. If this is false the form + existing comments will be hidden #### Since 2.4 - Always show them by default
`public static String` | $order_comments_by | # Define how you want to order page comments by. By default order by newest to oldest. Define how you want to order page comments by. By default order by newest to oldest. #### Since 2.4
`public static array` | $required_fields | # Required fields for Comment Form Required fields for Comment Form by menedem

### Properties inherited from RequestHandler

`$brokenOnConstruct`, `$request`

### Properties inherited from ViewableData

`$casting`, `$customisedObject`, `$default_cast`, `$failover`, `$iteratorPos`, `$iteratorTotalItems`

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -