Skip to content

Commit

Permalink
Merge branch 'latenzio-develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
therouv committed Nov 17, 2016
2 parents 13575ed + d2a63a6 commit 99da69f
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions Block/Imprint/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace FireGento\MageSetup\Block\Imprint;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Directory\Api\CountryInformationAcquirerInterface;
use Magento\Framework\Exception\NoSuchEntityException;

/**
* Class Content
Expand All @@ -22,16 +24,23 @@ class Content extends \Magento\Framework\View\Element\Template
private $scopeConfig;

/**
* @var CountryInformationAcquirerInterface
*/
private $countryInformationAcquirer;

/**
* @param CountryInformationAcquirerInterface $countryInformationAcquirer
* @param \Magento\Framework\View\Element\Template\Context $context
* @param array $data
* @param array $data
*/
public function __construct(
\Magento\Directory\Api\CountryInformationAcquirerInterface $countryInformationAcquirer,
\Magento\Framework\View\Element\Template\Context $context,
array $data = []
)
{
) {
parent::__construct($context, $data);
$this->scopeConfig = $context->getScopeConfig();
$this->countryInformationAcquirer = $countryInformationAcquirer;
}

/**
Expand All @@ -42,10 +51,18 @@ public function __construct(
public function getCountry()
{
$countryCode = $this->getImprintValue('country');
if (!$countryCode) {
return '';
}

// TODO: Get country name
try {
$countryInfo = $this->countryInformationAcquirer->getCountryInfo($countryCode);
$countryName = $countryInfo->getFullNameLocale();
} catch (NoSuchEntityException $e) {
$countryName = '';
}

return $countryCode;
return $countryName;
}

/**
Expand Down

0 comments on commit 99da69f

Please sign in to comment.