Log useful error message if select or radio custom field has no values

This commit is contained in:
nathangray 2018-11-28 11:05:58 -07:00
parent 579b4f6923
commit 4b989d016c

View File

@ -216,7 +216,11 @@ class Customfields implements \IteratorAggregate
case 'select': case 'select':
case 'radio': case 'radio':
if (count($field['values']) == 1 && isset($field['values']['@'])) if(!$field['values'])
{
error_log("{$field['app']} custom field '{$field['name']}' has no values" );
}
else if (count($field['values']) == 1 && isset($field['values']['@']))
{ {
$field['values'] = self::get_options_from_file($field['values']['@']); $field['values'] = self::get_options_from_file($field['values']['@']);
} }
@ -259,6 +263,7 @@ class Customfields implements \IteratorAggregate
} }
break; break;
} }
restore_error_handler();
return $value; return $value;
} }