addComment

The addComment hook is triggered when a comment is added. It passes the ID of the record and the data array as arguments and does not expect a return value.

Available

from Contao 2.8.2.

Parameters

  1. int $intId

    ID of the new comment database record (Table tl_comment).

  2. array $arrSet

    Data of the new comment record (not including the ID).

  3. object $objComments

    The instance of the Comments class that triggered the hook.

Example

<?php

// config.php
$GLOBALS['TL_HOOKS']['addComment'][] = array('MyClass', 'myAddComment');

// MyClass.php

/**
 * @param  integer  $intId       id of the comment
 * @param  array    $arrSet      The comments data
 * @param  Comments $objComments The Comments object
 * @return void                  No return value expected
 */
public function myAddComment($intId, $arrSet, Comments $objComments)
{
    // Do something
}

More information

References

See also

results matching ""

    No results matching ""