protected function EntityHelperTrait::entityAuthor in Facebook Instant Articles 8.2
Same name and namespace in other branches
- 3.x src/Normalizer/EntityHelperTrait.php \Drupal\fb_instant_articles\Normalizer\EntityHelperTrait::entityAuthor()
Helper function to pull the author name out of an entity.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: Content entity being normalized.
Return value
string|null Author name if there is one.
2 calls to EntityHelperTrait::entityAuthor()
- InstantArticleContentEntityNormalizer::normalizeDefaultHeader in src/
Normalizer/ InstantArticleContentEntityNormalizer.php - Normalize the default header of the instant article.
- InstantArticleRssContentEntityNormalizer::normalize in src/
Normalizer/ InstantArticleRssContentEntityNormalizer.php
File
- src/
Normalizer/ EntityHelperTrait.php, line 93
Class
- EntityHelperTrait
- Common entity data getters shared between the normalizers.
Namespace
Drupal\fb_instant_articles\NormalizerCode
protected function entityAuthor(ContentEntityInterface $entity) {
// Default the article author to the username.
if ($entity instanceof EntityOwnerInterface && ($owner = $entity
->getOwner())) {
return $owner
->getDisplayName();
}
}