engine = $engine; $this->translatableStringHelper = $translatableStringHelper; } /** * @param ThirdParty $entity */ public function renderBox($entity, array $options): string { $params = [ 'with_valid_from' => $options['with_valid_from'] ?? true, 'addLink' => $options['addLink'] ?? false, 'addEntity' => $options['addEntity'] ?? false, 'addId' => $options['addId'] ?? false, 'addInfo' => $options['addInfo'] ?? false, 'hLevel' => $options['hLevel'] ?? 3, 'customButtons' => $options['customButtons'] ?? [], 'customArea' => $options['customArea'] ?? [], 'showContacts' => $options['showContacts'] ?? false, 'showParent' => $options['showParent'] ?? true, 'isConfidential' => $options['isConfidential'] ?? false, ]; return $this->getDefaultOpeningBox('thirdparty') . $this->engine->render('@ChillThirdParty/Entity/thirdparty.html.twig', [ 'thirdparty' => $entity, 'render' => $options['render'] ?? 'raw', 'options' => $params, ]) . $this->getDefaultClosingBox(); } /** * @param ThirdParty $entity */ public function renderString($entity, array $options): string { if ($entity->getCivility() !== null) { $civility = $this->translatableStringHelper ->localize($entity->getCivility()->getAbbreviation()) . ' '; } else { $civility = ''; } if (!empty($entity->getAcronym())) { $acronym = ' (' . $entity->getAcronym() . ')'; } else { $acronym = ''; } return $civility . $entity->getName() . $acronym; } public function supports($entity, array $options): bool { return $entity instanceof ThirdParty; } }