*/ class ActivityReasonRender implements ChillEntityRenderInterface { use BoxUtilsChillEntityRenderTrait; /** * @var TranslatableStringHelper */ protected $translatableStringHelper; public function __construct(TranslatableStringHelper $translatableStringHelper) { $this->translatableStringHelper = $translatableStringHelper; } public function renderBox($entity, array $options): string { return $this->getDefaultOpeningBox('activity-reason'). ''. ' '. ''. $this->translatableStringHelper->localize( $entity->getCategory()->getName() ). ''. ' > '. ''. $this->translatableStringHelper->localize( $entity->getName() ). ''. ''. $this->getDefaultClosingBox(); } public function renderString($entity, array $options): string { $category = ''; if (null !== $entity->getCategory()) { $category = $this->translatableStringHelper->localize( $entity->getCategory()->getName() ).' > '; } return $category. $this->translatableStringHelper->localize( $entity->getName() ); } public function supports($entity, array $options): bool { return $entity instanceof ActivityReason; } }