src/Extensions/CommentsExtension.php
public function CommentsForm()
    {
        // Check if enabled
        $enabled = $this->getCommentsEnabled();
        if ($enabled && $this->owner->getCommentsOption('include_js')) {
            Requirements::javascript('//code.jquery.com/jquery-3.3.1.min.js');
            Requirements::javascript('silverstripe/comments:thirdparty/jquery-validate/jquery.validate.min.js');
            Requirements::javascript('silverstripe/admin:client/dist/js/i18n.js');
            Requirements::add_i18n_javascript('silverstripe/comments:javascript/lang');
            Requirements::javascript('silverstripe/comments:javascript/CommentsInterface.js');
        }

        $controller = CommentingController::create();
        $controller->setOwnerRecord($this->owner);
        $controller->setParentClass($this->owner->getClassName());
        $controller->setOwnerController(Controller::curr());

        $session = Controller::curr()->getRequest()->getSession();
        $moderatedSubmitted = $session->get('CommentsModerated');
        $session->clear('CommentsModerated');

        $form = ($enabled) ? $controller->CommentsForm() : false;

        // a little bit all over the show but to ensure a slightly easier upgrade for users
        // return back the same variables as previously done in comments
        return $this
            ->owner
            ->customise([
                'AddCommentForm' => $form,
                'ModeratedSubmitted' => $moderatedSubmitted,
            ])
            ->renderWith('CommentsInterface');
    }
public function CommentsForm()
    {
        // Check if enabled
        $enabled = $this->getCommentsEnabled();
        if ($enabled && $this->owner->getCommentsOption('include_js')) {
            Requirements::javascript('//code.jquery.com/jquery-3.3.1.min.js');
            Requirements::javascript('silverstripe/comments:thirdparty/jquery-validate/jquery.validate.min.js');
            Requirements::javascript('silverstripe/admin:client/dist/js/i18n.js');
            Requirements::add_i18n_javascript('silverstripe/comments:javascript/lang');
            Requirements::javascript('silverstripe/comments:javascript/CommentsInterface.js');
        }

        $controller = CommentingController::create();
        $controller->setOwnerRecord($this->owner);
        $controller->setParentClass($this->owner->getClassName());
        $controller->setOwnerController(Controller::curr());

        $session = Controller::curr()->getRequest()->getSession();
        $moderatedSubmitted = $session->get('CommentsModerated');
        $session->clear('CommentsModerated');

        $form = ($enabled) ? $controller->CommentsForm() : false;

        // a little bit all over the show but to ensure a slightly easier upgrade for users
        // return back the same variables as previously done in comments
        return $this
            ->owner
            ->customise([
                'AddCommentForm' => $form,
                'ModeratedSubmitted' => $moderatedSubmitted,
            ])
            ->renderWith('CommentsInterface');
    }
public function CommentsForm ( ) { // Check if enabled $ enabled = $ this -> getCommentsEnabled ( ) ; if ( $ enabled && $ this -> owner -> getCommentsOption ( 'include_js' ) ) { Requirements :: javascript ( '//code.jquery.com/jquery-3.3.1.min.js' ) ; Requirements :: javascript ( 'silverstripe/comments:thirdparty/jquery-validate/jquery.validate.min.js' ) ; Requirements :: javascript ( 'silverstripe/admin:client/dist/js/i18n.js' ) ; Requirements :: add_i18n_javascript ( 'silverstripe/comments:javascript/lang' ) ; Requirements :: javascript ( 'silverstripe/comments:javascript/CommentsInterface.js' ) ; } $ controller = CommentingController :: create ( ) ; $ controller -> setOwnerRecord ( $ this -> owner ) ; $ controller -> setParentClass ( $ this -> owner -> getClassName ( ) ) ; $ controller -> setOwnerController ( Controller :: curr ( ) ) ; $ session = Controller :: curr ( ) -> getRequest ( ) -> getSession ( ) ; $ moderatedSubmitted = $ session -> get ( 'CommentsModerated' ) ; $ session -> clear ( 'CommentsModerated' ) ; $ form = ( $ enabled ) ? $ controller -> CommentsForm ( ) : false ; // a little bit all over the show but to ensure a slightly easier upgrade for users // return back the same variables as previously done in comments return $ this -> owner -> customise ( [ 'AddCommentForm' => $ form , 'ModeratedSubmitted' => $ moderatedSubmitted , ] ) -> renderWith ( 'CommentsInterface' ) ; }
Comments interface for the front end. Includes the CommentAddForm and the composition
of the comments display.

To customize the html see templates/CommentInterface.ss or extend this function with
your own extension.

@todo Cleanup the passing of all this configuration based functionality

@see  docs/en/Extending
Comments interface for the front end . Includes the CommentAddForm and the composition of the comments display .