protected static function dropDownOptionsToArray($optionsString)
{
$options = explode('|', $optionsString);
$result = [];
foreach ($options as $index => $optionStr) {
$parts = explode(':', $optionStr, 2);
if (count($parts) > 1) {
$key = trim($parts[0]);
if (strlen($key)) {
if (!preg_match('/^[0-9a-z-_]+$/i', $key)) {
throw new ValidationException(['snippetProperties' => Lang::get('rainlab.pages::lang.snippet.invalid_option_key', ['key' => $key])]);
}
$result[$key] = trim($parts[1]);
} else {
$result[$index] = trim($optionStr);
}
} else {
$result[$index] = trim($optionStr);
}
}
return $result;
}