class Depth
Same name and namespace in other branches
- 11.x 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\Component\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\field\FieldPluginBase extends \Drupal\views\Plugin\views\field\FieldHandlerInterface implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\field\EntityField extends \Drupal\Core\Cache\CacheableDependencyInterface, \Drupal\views\Plugin\views\field\MultiItemsFieldHandlerInterface, \Drupal\views\Plugin\DependentWithRemovalPluginInterface uses \Drupal\views\FieldAPIHandlerTrait, \Drupal\Core\Plugin\PluginDependencyTrait implements \Drupal\views\Plugin\views\field\FieldPluginBase
- class \Drupal\comment\Plugin\views\field\Depth implements \Drupal\views\Plugin\views\field\EntityField
- class \Drupal\views\Plugin\views\field\EntityField extends \Drupal\Core\Cache\CacheableDependencyInterface, \Drupal\views\Plugin\views\field\MultiItemsFieldHandlerInterface, \Drupal\views\Plugin\DependentWithRemovalPluginInterface uses \Drupal\views\FieldAPIHandlerTrait, \Drupal\Core\Plugin\PluginDependencyTrait implements \Drupal\views\Plugin\views\field\FieldPluginBase
- class \Drupal\views\Plugin\views\field\FieldPluginBase extends \Drupal\views\Plugin\views\field\FieldHandlerInterface implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of Depth
Related topics
20 string references to 'Depth'
- Book::query in core/
modules/ book/ src/ Plugin/ migrate/ source/ Book.php - BookOutlineStorage::getBookMenuTree in core/
modules/ book/ src/ BookOutlineStorage.php - BookOutlineStorage::getChildRelativeDepth in core/
modules/ book/ src/ BookOutlineStorage.php - BookOutlineStorage::updateMovedChildren in core/
modules/ book/ src/ BookOutlineStorage.php - book_views_data in core/
modules/ book/ book.views.inc - Implements hook_views_data().
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;
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.