CountryListBuilder.php in Ubercart 8.4
File
uc_country/src/CountryListBuilder.php
View source
<?php
namespace Drupal\uc_country;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Link;
use Drupal\Core\Url;
class CountryListBuilder extends ConfigEntityListBuilder {
protected $limit = 250;
public function buildHeader() {
$header['title'] = $this
->t('Name');
$header['code'] = $this
->t('Code');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['title'] = $entity
->label();
$row['code'] = $entity
->id();
return $row + parent::buildRow($entity);
}
public function render() {
$build['description'] = [
'#markup' => $this
->t("<p>This is a list of the countries currently" . " defined for use on your Drupal site. This country data adheres to" . " the @iso standard for country and zone naming used by payment" . " providers and package couriers.</p>" . "<p>To make a country available for use at checkout or in a user's" . " address book, 'Enable' the country using the widget in the" . " 'Operations' for that country. You may also 'Disable' a country to" . " prevent customers from selecting that country as a billing or" . " shipping address.</p>" . "<p>You may also use the 'Edit' widget in the 'Operations' column to" . " edit a country's name or address format.</p>", [
'@iso' => Link::fromTextAndUrl('ISO 3166', Url::fromUri('http://en.wikipedia.org/wiki/ISO_3166'))
->toString(),
]),
];
$build += parent::render();
$build['table']['#empty'] = $this
->t('No countries have been configured yet.');
return $build;
}
}