Skip to content

Commit

Permalink
added option for sorting options, added html_entity_decode for option…
Browse files Browse the repository at this point in the history
… labels
  • Loading branch information
Dennis Patzer committed Jun 5, 2018
1 parent 2c0b4af commit 63a2e7b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/Choice/FieldOptionsChoice.php
Expand Up @@ -67,9 +67,15 @@ protected function collect()
$option['label'] = $translator->trans($option['label']);
}

$option['label'] = html_entity_decode($option['label']);

$choices[$option['label']] = $option['value'];
}

if ($element->sortOptionValues) {
asort($choices);
}

return $choices;
}

Expand Down
17 changes: 12 additions & 5 deletions src/Resources/contao/dca/tl_filter_config_element.php
Expand Up @@ -113,11 +113,11 @@
'range' => '{general_legend},title,type,isInitial;{config_legend},field,customName,customOperator,addDefaultValue,min,max,step;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'tel' => '{general_legend},title,type,isInitial;{config_legend},field,customName,customOperator,addDefaultValue;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'color' => '{general_legend},title,type,isInitial;{config_legend},field,customName,customOperator,addDefaultValue;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'choice' => '{general_legend},title,type,isInitial;{config_legend},field,customOptions,customName,customOperator,addDefaultValue,expanded,multiple,submitOnChange;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'country' => '{general_legend},title,type,isInitial;{config_legend},field,customCountries,customOptions,customName,customOperator,addDefaultValue,expanded,multiple;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'language' => '{general_legend},title,type,isInitial;{config_legend},field,customLanguages,customOptions,customName,customOperator,addDefaultValue,expanded,multiple;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'locale' => '{general_legend},title,type,isInitial;{config_legend},field,customLocales,customOptions,customName,customOperator,addDefaultValue,expanded,multiple;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'parent' => '{general_legend},title,type,isInitial;{config_legend},field,customOptions,customName,customOperator,addDefaultValue,expanded,multiple;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'choice' => '{general_legend},title,type,isInitial;{config_legend},field,customOptions,sortOptionValues,customName,customOperator,addDefaultValue,expanded,multiple,submitOnChange;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'country' => '{general_legend},title,type,isInitial;{config_legend},field,customCountries,customOptions,sortOptionValues,customName,customOperator,addDefaultValue,expanded,multiple;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'language' => '{general_legend},title,type,isInitial;{config_legend},field,customLanguages,customOptions,sortOptionValues,customName,customOperator,addDefaultValue,expanded,multiple;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'locale' => '{general_legend},title,type,isInitial;{config_legend},field,customLocales,customOptions,sortOptionValues,customName,customOperator,addDefaultValue,expanded,multiple;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'parent' => '{general_legend},title,type,isInitial;{config_legend},field,customOptions,sortOptionValues,customName,customOperator,addDefaultValue,expanded,multiple;{visualization_legend},addPlaceholder,customLabel,hideLabel,inputGroup;{expert_legend},cssClass;{publish_legend},published;',
'visible' => '{general_legend},title,type;{config_legend},field,customName,invertField,ignoreFePreview,addStartAndStop;{publish_legend},published;',
'hidden' => '{general_legend},title,type,isInitial;{config_legend},field,customName,customOperator,addDefaultValue;{expert_legend},cssClass;{publish_legend},published;',
'button' => '{general_legend},title,type;{config_legend},name,label;{expert_legend},cssClass;{publish_legend},published;',
Expand Down Expand Up @@ -251,6 +251,13 @@
],
'sql' => "blob NULL",
],
'sortOptionValues' => [
'label' => &$GLOBALS['TL_LANG']['tl_filter_config_element']['sortOptionValues'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => ['tl_class' => 'w50'],
'sql' => "char(1) NOT NULL default ''"
],
'customName' => [
'label' => &$GLOBALS['TL_LANG']['tl_filter_config_element']['customName'],
'exclude' => true,
Expand Down
Expand Up @@ -11,6 +11,7 @@
$lang['field'] = ['DCA-Feld', 'Wählen Sie hier das verknüpfte DCA-Feld aus.'];
$lang['fields'] = ['Felder', 'Wählen Sie hier mehrere Felder aus, die in der gewählten Reihenfolge verknüpft werden sollen.'];
$lang['customOptions'] = ['Optionen anpassen', 'Wählen Sie diese Option, um benutzerdefinierte Optionswerte festzulegen.'];
$lang['sortOptionValues'] = ['Optionen sortieren', 'Wählen Sie diese Option, um die Optionswerte alphabetisch zu sortieren.'];
$lang['options'] = ['Optionen', 'Wenn JavaScript deaktiviert ist, speichern Sie Ihre Änderungen, bevor Sie die Reihenfolge verändern.'];
$lang['customName'] = ['Name anpassen', 'Setzen Sie hier einen benutzerdefinierten Namen.'];
$lang['name'] = ['Formularfeldname', 'Geben Sie hier den gewünschten Namen im HTML-Formular ein.'];
Expand Down

0 comments on commit 63a2e7b

Please sign in to comment.