Revision def4a030
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/DB/CustomVariableConfig.pm | ||
---|---|---|
5 | 5 |
|
6 | 6 |
use strict; |
7 | 7 |
|
8 |
use List::MoreUtils qw(any); |
|
9 |
|
|
8 | 10 |
use SL::DB::MetaSetup::CustomVariableConfig; |
9 | 11 |
use SL::DB::Manager::CustomVariableConfig; |
10 | 12 |
use SL::DB::Helper::ActsAsList; |
... | ... | |
87 | 89 |
return $self->processed_flags()->{$flag}; |
88 | 90 |
} |
89 | 91 |
|
92 |
sub type_dependant_default_value { |
|
93 |
my ($self) = @_; |
|
94 |
|
|
95 |
return $self->default_value if $self->type ne 'select'; |
|
96 |
return (any { $_ eq $self->default_value } @{ $self->processed_options }) ? $self->default_value : $self->processed_options->[0]; |
|
97 |
} |
|
98 |
|
|
90 | 99 |
1; |
SL/DB/Helper/CustomVariables.pm | ||
---|---|---|
196 | 196 |
# value needs config |
197 | 197 |
$inherited_value |
198 | 198 |
? $cvar->value($inherited_value) |
199 |
: $cvar->value($params{config}->default_value); |
|
199 |
: $cvar->value($params{config}->type_dependant_default_value);
|
|
200 | 200 |
return $cvar; |
201 | 201 |
} |
202 | 202 |
|
Auch abrufbar als: Unified diff
CVars: beim Autovivifien gültigen Wert für selects forçieren