Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176
This commit is contained in:
commit
9921556621
13277 changed files with 1459781 additions and 0 deletions
49
core/modules/comment/comment.api.php
Normal file
49
core/modules/comment/comment.api.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\comment\CommentInterface;
|
||||
use Drupal\Core\Url;
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Hooks provided by the Comment module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @addtogroup hooks
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Alter the links of a comment.
|
||||
*
|
||||
* @param array &$links
|
||||
* A renderable array representing the comment links.
|
||||
* @param \Drupal\comment\CommentInterface $entity
|
||||
* The comment being rendered.
|
||||
* @param array &$context
|
||||
* Various aspects of the context in which the comment links are going to be
|
||||
* displayed, with the following keys:
|
||||
* - 'view_mode': the view mode in which the comment is being viewed
|
||||
* - 'langcode': the language in which the comment is being viewed
|
||||
* - 'commented_entity': the entity to which the comment is attached
|
||||
*
|
||||
* @see \Drupal\comment\CommentViewBuilder::renderLinks()
|
||||
* @see \Drupal\comment\CommentViewBuilder::buildLinks()
|
||||
*/
|
||||
function hook_comment_links_alter(array &$links, CommentInterface $entity, array &$context) {
|
||||
$links['mymodule'] = array(
|
||||
'#theme' => 'links__comment__mymodule',
|
||||
'#attributes' => array('class' => array('links', 'inline')),
|
||||
'#links' => array(
|
||||
'comment-report' => array(
|
||||
'title' => t('Report'),
|
||||
'url' => Url::fromRoute('comment_test.report', ['comment' => $entity->id()], ['query' => ['token' => \Drupal::getContainer()->get('csrf_token')->get("comment/{$entity->id()}/report")]]),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup hooks".
|
||||
*/
|
Reference in a new issue