Last active
September 24, 2018 23:52
-
-
Save kmgdevelopment/290abdfc316ceab15134cd711ea0cf16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public function normalizeValue($value, ElementInterface $element = null) | |
{ | |
$opts = $this->setOptions(); | |
$value = array | |
( | |
'value' => $value, | |
'label' => $opts[$value] | |
); | |
return $value; | |
} | |
public function serializeValue($value, ElementInterface $element = null) | |
{ | |
return parent::serializeValue($value['value'], $element); | |
} | |
private function setOptions() | |
{ | |
include '_Regions.php'; | |
$opts; | |
if( $this->regionType == 'countries' ) | |
{ | |
$opts = $countries; | |
} | |
elseif( $this->regionType == 'usStates' ) | |
{ | |
$opts = array_merge($states, $provinces); | |
} | |
return $opts; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment