public static function getPropertyOptions(GetPropertyOptionsEvent $event)
{
if (null !== $event->getOptions()) {
return;
}
$model = $event->getModel();
if (!$model instanceof Model) {
return;
}
$attribute = $model->getItem()->getAttribute($event->getPropertyName());
if (!$attribute instanceof IAttribute) {
return;
}
try {
$options = $attribute->getFilterOptions(null, false);
} catch (\Exception $exception) {
$options = array('Error: ' . $exception->getMessage());
}
$event->setOptions($options);
}