mirror of
https://github.com/silverstripe/silverstripe-comments
synced 2024-10-22 11:05:49 +02:00
Initial cut at new commenting configuration API
This commit is contained in:
parent
b9970c1f94
commit
3b5afbce23
18
_config.php
18
_config.php
@ -3,14 +3,24 @@
|
||||
/**
|
||||
* Comments Default Configuration
|
||||
*
|
||||
* To enable comments on your own {@link DataObject}'s then
|
||||
* add the extension 'CommentsExtension' to your object
|
||||
* To enable comments on your own {@link DataObject}'s you need to
|
||||
* call Commenting::add_comments($object_name, $settings);
|
||||
*
|
||||
* Where $object_name is the name of the subclass of DataObject you want
|
||||
* to add the comments to and $settings is a map of configuration options
|
||||
* and values
|
||||
*
|
||||
* Example: mysite/_config.php
|
||||
*
|
||||
* <code>
|
||||
* Object::add_extension('Page', 'CommentsExtension');
|
||||
* // uses the default values
|
||||
* Commenting::add('SiteTree');
|
||||
*
|
||||
* // set configuration
|
||||
* Commenting::add('SiteTree', array(
|
||||
* 'require_login' => true
|
||||
* ));
|
||||
* </code>
|
||||
*/
|
||||
|
||||
Object::add_extension('Page', 'CommentsExtension');
|
||||
Commenting::add('Page');
|
61
code/Commenting.php
Normal file
61
code/Commenting.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Helper Class for storing the configuration options. Retains the mapping between
|
||||
* objects which have comments attached and the related configuration options.
|
||||
*
|
||||
* Also handles adding the Commenting extension to the {@link DataObject} on behalf
|
||||
* of the user.
|
||||
*
|
||||
* For documentation on how to use this class see docs/en/Configuration.md
|
||||
*
|
||||
* @package comments
|
||||
*/
|
||||
|
||||
class Commenting {
|
||||
|
||||
/**
|
||||
* @var array map of enabled {@link DataObject} and related configuration
|
||||
*/
|
||||
private static $enabled_classes = array();
|
||||
|
||||
/**
|
||||
* @var array default configuration values
|
||||
*/
|
||||
private static $default_configuration = array(
|
||||
'require_login' => false, // boolean, whether a user needs to login
|
||||
'required_permission' => '', // required permission to comment (or array of permissions)
|
||||
'use_ajax_commenting' => true, // use ajax to post comments.
|
||||
'show_comments_when_disabled' => false, // when comments are disabled should we show older comments (if available)
|
||||
'order_comments_by' => "\"Created\" DESC"
|
||||
);
|
||||
|
||||
|
||||
public function add($class, $settings) {
|
||||
|
||||
}
|
||||
|
||||
public function remove($class) {
|
||||
|
||||
}
|
||||
|
||||
public function set_config($class, $configuration) {
|
||||
|
||||
}
|
||||
|
||||
public function set_config_value($class, $key, $value = false) {
|
||||
|
||||
}
|
||||
|
||||
public function get_config($class) {
|
||||
|
||||
}
|
||||
|
||||
public function get_config_value($class, $key) {
|
||||
|
||||
}
|
||||
|
||||
public function config_value_equals($class, $key, $value) {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user