permalink(); if ($comment->hasField('comment_body') && ($body = $comment->get('comment_body')->value)) { $attributes = $comment_permalink->getOption('attributes') ?: []; $attributes += ['title' => Unicode::truncate($body, 128)]; $comment_permalink->setOption('attributes', $attributes); } return $comment_permalink; } /** * {@inheritdoc} */ public static function isApplicable(FieldDefinitionInterface $field_definition) { return parent::isApplicable($field_definition) && $field_definition->getTargetEntityTypeId() === 'comment' && $field_definition->getName() === 'subject'; } }