public function CommentUserSignature::build in Display Suite 8.2
Same name and namespace in other branches
- 8.4 src/Plugin/DsField/Comment/CommentUserSignature.php \Drupal\ds\Plugin\DsField\Comment\CommentUserSignature::build()
- 8.3 src/Plugin/DsField/Comment/CommentUserSignature.php \Drupal\ds\Plugin\DsField\Comment\CommentUserSignature::build()
Renders a field.
Overrides Markup::build
File
- src/
Plugin/ DsField/ Comment/ CommentUserSignature.php, line 23
Class
- CommentUserSignature
- Plugin that renders the user signature of a comment.
Namespace
Drupal\ds\Plugin\DsField\CommentCode
public function build() {
$comment = $this
->entity();
$user_id = $comment->uid->target_id;
$user = User::load($user_id);
$key = $this
->key();
if (isset($user->{$key}->value)) {
$format = $this
->format();
return array(
'#type' => 'processed_text',
'#text' => $user->{$key}->value,
'#format' => $user->{$format}->value,
'#filter_types_to_skip' => array(),
'#langcode' => '',
);
}
return array();
}