SocialCommentFieldItemList.php in Open Social 10.2.x
Same filename and directory in other branches
- 8.9 modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 8 modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 8.2 modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 8.3 modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 8.4 modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 8.5 modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 8.6 modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 8.7 modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 8.8 modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 10.3.x modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 10.0.x modules/social_features/social_comment/src/SocialCommentFieldItemList.php
- 10.1.x modules/social_features/social_comment/src/SocialCommentFieldItemList.php
Namespace
Drupal\social_commentFile
modules/social_features/social_comment/src/SocialCommentFieldItemList.phpView source
<?php
namespace Drupal\social_comment;
use Drupal\Core\Access\AccessResult;
use Drupal\comment\CommentFieldItemList;
use Drupal\Core\Session\AccountInterface;
/**
* Override default item list class for comment fields.
*/
class SocialCommentFieldItemList extends CommentFieldItemList {
/**
* {@inheritdoc}
*/
public function access($operation = 'view', AccountInterface $account = NULL, $return_as_object = FALSE) {
if ($operation === 'edit') {
// Only users with administer own comment settings permission can edit
// the comment status field.
$result = AccessResult::allowedIfHasPermission($account ?: \Drupal::currentUser(), 'administer own comments');
return $return_as_object ? $result : $result
->isAllowed();
}
return parent::access($operation, $account, $return_as_object);
}
}
Classes
Name![]() |
Description |
---|---|
SocialCommentFieldItemList | Override default item list class for comment fields. |