Jump to content

Developer Documentation

Comments

  1. The Comment Model

    Inheritance chain Your comment model extends several classes. In turn, these are: \IPS\Content\Comment Provides the features of Comments. The rest of the guides in this section cover implementing these features. \IPS\Content Provides a small number of features which are common to both Content Item models and Content Comment models such as getting the author and working with $databaseColumnMap. \IPS\Patterns\ActiveRecord Provides the functionality to load items f
  2. Supporting comments in content items

    In order to use comments, you'll need to make a few adjustments to your content item model too.   Class property changes You will need to add new properties to your content item model.   public static $commentClass = 'string'; This should be the full path to your comment model class. For example: public static $commentClass = 'IPS\yourApp\YourCommentClass';   protected static $firstCommentRequired = boolean; If your content item requires a first comme
  3. Displaying comments in your application

    EditorLocations extension In order to display the editor field that enables users to leave comments, you will first need to create the EditorLocations extension for your application. For more information on doing this, consult the WYSIWYG Editor guide.   Displaying comments It's up to you how comments are displayed in your application. Some applications will display comments in a traditional way, while others may require something much more custom. However you choose to displ
  4. Supporting search for comments

    Note: In order to support searching of comments, your content items must also be searchable. Consult the searching content items guide for more information.   Implementing search All that is required to support searching of your item's comments is to implement the search interface, like so: implements \IPS\Content\Searchable
   Changed behaviors after implementation Comments will be indexed and included in search results and the activity stream. The index will au
  5. Supporting the report center in comments

    How to implement reporting for comments Firstly, your comment model needs to implement the reporting interface, like so: implements \IPS\Content\ReportCenter You will also need to define a new property on your model: public static $icon = 'string'; This property specifies a FontAwesome icon that will be used to identify this content in the report center. The value should be the name of the icon, without the fa- prefix.   Additional model methods available bool
  6. Implementing edit history for comments

    Comments can use the built-in edit history functionality to log when the comment text is edited, as well as track versions of the comment.   Implementing edit history First, your comment model will need to implement the edit history interface, like so: implements \IPS\Content\EditHistory Next, you will need to add additional elements to your $databaseColumnMap property: edit_time Required. Should contain the column name that holds a unix timestamp of when the comment
  7. Hiding/approving comments

    Comments can be hidden to non-staff members. This can be used to require approval by staff before comments are shown, or as a way for staff to reactively hide comments deemed undesirable and unsuitable for public display.   How to implement hiding/approving First, you will need to implement the hiding/approving interface in your comment model, like so: implements \IPS\Content\Hideable Next, add either a hidden or approved key to your $databaseColumnMap property, with the va
  8. Supporting reputation for comments

    How to implement reputation First, your comment model must implement the reputation interface, like so: implements \IPS\Content\Reputation Next, you need to add a property to your model: public static $reputationType = ‘string’; This property identifies this kind of content from others within the reputation system. It can be anything you like, but the convention is to use the name of the column in your database that stores the ID. For example: public static $reputationTy
×
×
  • Create New...