Overview

Namespaces

  • None
  • PHP

Classes

  • Breadcrumb
  • Breadcrumbs
  • CacheFile
  • Comment
  • CommentArray
  • CommentFilter
  • CommentForm
  • CommentList
  • Config
  • Database
  • DatabaseQuery
  • DatabaseQuerySelect
  • DatabaseQuerySelectFulltext
  • DatabaseStopwords
  • Debug
  • Field
  • Fieldgroup
  • Fieldgroups
  • FieldgroupsArray
  • Fields
  • FieldsArray
  • Fieldtype
  • FieldtypeMulti
  • Fieldtypes
  • FileLog
  • FilenameArray
  • Fuel
  • HookEvent
  • ImageSizer
  • Inputfield
  • InputfieldsArray
  • InputfieldWrapper
  • Language
  • LanguageParser
  • Languages
  • LanguagesPageFieldValue
  • LanguageSupportInstall
  • LanguageTranslator
  • Markdown_Parser
  • MarkdownExtra_Parser
  • ModuleJS
  • ModulePlaceholder
  • Modules
  • Notice
  • NoticeError
  • NoticeMessage
  • Notices
  • NullPage
  • Page
  • PageArray
  • Pagefile
  • Pagefiles
  • PagefilesManager
  • PageFinder
  • Pageimage
  • Pageimages
  • PagerNav
  • PagerNavItem
  • Pages
  • PagesAccess
  • PagesSortfields
  • PagesType
  • Paths
  • Permission
  • Permissions
  • Process
  • ProcessController
  • ProcessWire
  • Role
  • Roles
  • Sanitizer
  • Selector
  • SelectorBitwiseAnd
  • SelectorContains
  • SelectorContainsLike
  • SelectorContainsWords
  • SelectorEnds
  • SelectorEqual
  • SelectorGreaterThan
  • SelectorGreaterThanEqual
  • SelectorLessThan
  • SelectorLessThanEqual
  • SelectorNotEqual
  • Selectors
  • SelectorStarts
  • Session
  • SessionCSRF
  • SmartyPants_Parser
  • SmartyPantsTypographer_Parser
  • SystemUpdate1
  • Template
  • TemplateFile
  • Templates
  • TemplatesArray
  • Textformatter
  • Textile
  • User
  • Users
  • Wire
  • WireArray
  • WireData
  • WireInput
  • WireInputData
  • WireSaveableItems
  • WireSaveableItemsLookup
  • WireUpload

Interfaces

  • CommentFormInterface
  • CommentListInterface
  • ConfigurableModule
  • FieldtypeLanguageInterface
  • FieldtypePageTitleCompatible
  • HasLookupItems
  • HasRoles
  • InputfieldHasArrayValue
  • Module
  • Saveable
  • TrackChanges

Exceptions

  • ProcessController404Exception
  • ProcessControllerPermissionException
  • Wire404Exception
  • WireDatabaseException
  • WireException
  • WirePermissionException

Functions

  • __
  • _n
  • _x
  • fuel
  • identify_modifier_markdown
  • Markdown
  • mdwp_add_p
  • mdwp_hide_tags
  • mdwp_show_tags
  • mdwp_strip_p
  • ProcessWireClassLoader
  • ProcessWireHostSiteConfig
  • ProcessWireShutdown
  • removeNewlines
  • SmartDashes
  • SmartEllipsis
  • SmartQuotes
  • smarty_modifier_markdown
  • smarty_modifier_smartypants
  • SmartyPants
  • tabIndent
  • unregisterGLOBALS
  • wire
  • wireDecodeJSON
  • wireEncodeJSON
  • wireMkdir
  • Overview
  • Namespace
  • Class
  • Tree
  • Download
 1: <?php
 2: 
 3: /**
 4:  * ProcessWire FieldtypeComments > CommentArray
 5:  *
 6:  * Maintains an array of multiple Comment instances.
 7:  * Serves as the value referenced when a FieldtypeComment field is reference from a Page.
 8:  * 
 9:  * ProcessWire 2.x 
10:  * Copyright (C) 2010 by Ryan Cramer 
11:  * Licensed under GNU/GPL v2, see LICENSE.TXT
12:  * 
13:  * http://www.processwire.com
14:  * http://www.ryancramer.com
15:  *
16:  */
17: 
18: class CommentArray extends WireArray {
19: 
20:     /**
21:      * Page that owns these comments, required to use the renderForm() or getCommentForm() methods. 
22:      *
23:      */
24:     protected $page = null; 
25: 
26:     /**
27:      * Per the WireArray interface, is the item a Comment
28:      *
29:      */
30:     public function isValidItem($item) {
31:         return $item instanceof Comment;    
32:     }
33: 
34:     /**
35:      * Provides the default rendering of a comment list, which may or may not be what you want
36:      *
37:      * @see CommentList class and override it to serve your needs
38:      *
39:      */
40:     public function render(array $options = array()) {
41:         $commentList = $this->getCommentList($options); 
42:         return $commentList->render();
43:     }
44: 
45:     /**
46:      * Provides the default rendering of a comment form, which may or may not be what you want
47:      *
48:      * @see CommentForm class and override it to serve your needs
49:      *
50:      */
51:     public function renderForm(array $options = array()) {
52:         $form = $this->getCommentForm($options); 
53:         return $form->render();
54:     }
55: 
56:     /**
57:      * Return instance of CommentList object
58:      *
59:      */
60:     public function getCommentList(array $options = array()) {
61:         return new CommentList($this, $options);    
62:     }
63: 
64:     /**
65:      * Return instance of CommentForm object
66:      *
67:      */
68:     public function getCommentForm(array $options = array()) {
69:         if(!$this->page) throw new WireException("You must set a page to this CommentArray before using iti.e. \$ca->setPage(\$page)"); 
70:         return new CommentForm($this->page, $this, $options); 
71:     }
72: 
73:     /**
74:      * Set the page that these comments are on 
75:      *
76:      */ 
77:     public function setPage(Page $page) {
78:         $this->page = $page; 
79:     }
80: 
81: }
82: 
83: 
84: 
ProcessWire API documentation generated by ApiGen 2.6.0