function PageContext::getBadgeStatus
Retrieves the badge status for the given entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity for which the status is being retrieved.
Return value
string|null The badge status if available. NULL otherwise.
1 call to PageContext::getBadgeStatus()
- PageContext::build in core/
modules/ navigation/ src/ Plugin/ TopBarItem/ PageContext.php - Builds and returns the renderable array for this top bar item plugin.
File
-
core/
modules/ navigation/ src/ Plugin/ TopBarItem/ PageContext.php, line 140
Class
- PageContext
- Provides the Page Context top bar item.
Namespace
Drupal\navigation\Plugin\TopBarItemCode
protected function getBadgeStatus(EntityInterface $entity) : ?string {
if (!$entity instanceof EntityPublishedInterface) {
return NULL;
}
return $entity->isPublished() ? 'success' : 'info';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.