46 public function getOptions($fieldInfos, $key, $addEmptyValue =
false, $reload =
false)
50 if (!isset(self::$options[$key]) || $reload) {
52 if (!empty($fieldInfos->options) && is_array($fieldInfos->options)) {
53 foreach ($fieldInfos->options as $optionKey => $optionLabel) {
54 $optionKey = (
string) $optionKey;
55 $optionLabel = (
string) $optionLabel;
56 if ($optionKey ==
'') {
61 $fieldValueParent =
'';
62 if (strpos($optionLabel,
"|") !==
false) {
63 list($optionLabel, $valueParent) = explode(
'|', $optionLabel);
64 $fieldValueParent = trim($fieldValueParent);
67 if (empty($optionLabel)) {
68 $optionLabel =
'(not defined)';
70 $optionLabel = $langs->trans($optionLabel);
73 $options[$optionKey] = array(
75 'label' => $optionLabel,
76 'parent' => $fieldValueParent,
80 if ($addEmptyValue && (!$fieldInfos->required || count($options) > 1)) {
91 self::$options[$key] = $options;
94 return self::$options[$key];