class Depth in Drupal 10
Same name and namespace in other branches
- 8 core/modules/comment/src/Plugin/views/field/Depth.php \Drupal\comment\Plugin\views\field\Depth
- 9 core/modules/comment/src/Plugin/views/field/Depth.php \Drupal\comment\Plugin\views\field\Depth
Field handler to display the depth of a comment.
Plugin annotation
@ViewsField("comment_depth");
Hierarchy
- class \Drupal\comment\Plugin\views\field\Depth extends \Drupal\views\Plugin\views\field\EntityField
Expanded class hierarchy of Depth
5 string references to 'Depth'
- book_views_data in core/
modules/ book/ book.views.inc - Implements hook_views_data().
- CommentViewsData::getViewsData in core/
modules/ comment/ src/ CommentViewsData.php - IndexTidDepth::buildOptionsForm in core/
modules/ taxonomy/ src/ Plugin/ views/ argument/ IndexTidDepth.php - taxonomy.views.schema.yml in core/
modules/ taxonomy/ config/ schema/ taxonomy.views.schema.yml - core/modules/taxonomy/config/schema/taxonomy.views.schema.yml
- TaxonomyIndexTidDepth::buildExtraOptionsForm in core/
modules/ taxonomy/ src/ Plugin/ views/ filter/ TaxonomyIndexTidDepth.php
File
- core/
modules/ comment/ src/ Plugin/ views/ field/ Depth.php, line 15
Namespace
Drupal\comment\Plugin\views\fieldView source
class Depth extends EntityField {
/**
* {@inheritdoc}
*/
public function getItems(ResultRow $values) {
$items = parent::getItems($values);
foreach ($items as &$item) {
// Work out the depth of this comment.
$comment_thread = $item['rendered']['#context']['value'];
$item['rendered']['#context']['value'] = count(explode('.', $comment_thread)) - 1;
}
return $items;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Depth:: |
public | function |