eventManager = $eventManager; $this->filterManager = $filterManager; $this->template = $template; } /** * Format address in a specific way * * @param DataObject $storeInfo * @param string $type * @return string */ public function format(DataObject $storeInfo, $type = 'html') { $this->eventManager->dispatch('store_address_format', ['type' => $type, 'store_info' => $storeInfo]); $address = $this->filterManager->template( $this->template, ['variables' => $storeInfo->getData()] ); if ($type == 'html') { $address = nl2br($address); } return $address; } }