Exemple #1
0
<?php

use Karwana\Penelope\Types\Country;
if ($property->getSchema()->isMultiValue()) {
    ?>
<ul class="multivalue">
	<?php 
    foreach ($property->getValue() as $value) {
        ?>
	<li><?php 
        __(_e(Country::getName($value, __locale())));
        ?>
</li>
	<?php 
    }
    ?>
</ul>
<?php 
} else {
    __(_e(Country::getName($property->getValue(), __locale())));
}
Exemple #2
0
<?php

use Karwana\Penelope\Types\Country;
$countries = array();
foreach (Country::getCodes() as $code) {
    $countries[$code] = Country::getName($code, __locale());
}
// Sort by country name using Unicode Collation Algorithm rules.
$collator = \Collator::create('root');
uasort($countries, function ($a, $b) use($collator) {
    return $collator->compare($a, $b);
});
if ($property->getSchema()->isMultiValue()) {
    foreach ((array) $property->getValue() as $value) {
        ?>
<select name="<?php 
        __(_e($property->getName()));
        ?>
[]">
	<option value=""><?php 
        __(_m('option_none'));
        ?>
</option>
<?php 
        foreach ($countries as $code => $name) {
            ?>
	<option value="<?php 
            __($code);
            ?>
"<?php 
            if (0 === strcasecmp($value, $code)) {