public function ReportContentType::render in Open Social 10.1.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php \Drupal\social_content_report\Plugin\views\field\ReportContentType::render()
- 8.5 modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php \Drupal\social_content_report\Plugin\views\field\ReportContentType::render()
- 8.6 modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php \Drupal\social_content_report\Plugin\views\field\ReportContentType::render()
- 8.7 modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php \Drupal\social_content_report\Plugin\views\field\ReportContentType::render()
- 8.8 modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php \Drupal\social_content_report\Plugin\views\field\ReportContentType::render()
- 10.3.x modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php \Drupal\social_content_report\Plugin\views\field\ReportContentType::render()
- 10.0.x modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php \Drupal\social_content_report\Plugin\views\field\ReportContentType::render()
- 10.2.x modules/social_features/social_content_report/src/Plugin/views/field/ReportContentType.php \Drupal\social_content_report\Plugin\views\field\ReportContentType::render()
Renders the field.
Parameters
\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.
Return value
string|\Drupal\Component\Render\MarkupInterface The rendered output. If the output is safe it will be wrapped in an object that implements MarkupInterface. If it is empty or unsafe it will be a string.
Overrides FieldPluginBase::render
File
- modules/
social_features/ social_content_report/ src/ Plugin/ views/ field/ ReportContentType.php, line 25
Class
- ReportContentType
- Field handler to present the entity type or bundle type for Nodes.
Namespace
Drupal\social_content_report\Plugin\views\fieldCode
public function render(ResultRow $row) {
/** @var \Drupal\flag\FlaggingInterface $flagging */
$flagging = $this
->getEntity($row);
$reported_entity = $flagging
->getFlaggable();
if ($reported_entity
->getEntityTypeId() === 'node') {
/** @var \Drupal\node\NodeInterface $reported_entity */
return node_get_type_label($reported_entity);
}
else {
return $reported_entity
->getEntityType()
->getLabel();
}
}