1 # This file has been auto-generated only because it didn't exist.
2 # Feel free to modify it at will; it will not be overwritten automatically.
4 package SL::DB::CustomVariableConfig;
8 use SL::DB::MetaSetup::CustomVariableConfig;
9 use SL::DB::Manager::CustomVariableConfig;
10 use SL::DB::Helper::ActsAsList;
12 __PACKAGE__->meta->initialize;
14 __PACKAGE__->configure_acts_as_list(group_by => [qw(module)]);
20 push @errors, $::locale->text('The name is missing.') if !$self->name;
21 push @errors, $::locale->text('The description is missing.') if !$self->description;
22 push @errors, $::locale->text('The type is missing.') if !$self->type;
23 push @errors, $::locale->text('The option field is empty.') if (($self->type || '') eq 'select') && !$self->options;
28 use constant OPTION_DEFAULTS =>
35 sub processed_options {
38 if( exists($self->{processed_options_cache}) ) {
39 return $self->{processed_options_cache};
42 my $ops = $self->options;
45 if ( $self->type eq 'select' ) {
46 my @op_array = split('##', $ops);
50 $ret = {%{$self->OPTION_DEFAULTS}};
51 while ( $ops =~ /\s*([^=\s]+)\s*=\s*([^\s]*)(?:\s*|$)/g ) {
56 $self->{processed_options_cache} = $ret;
64 if( exists($self->{processed_flags_cache}) ) {
65 return $self->{processed_flags_cache};
68 my $flags = $self->flags;
71 foreach my $flag (split m/:/, $flags) {
72 if ( $flag =~ m/(.*?)=(.*)/ ) {
79 $self->{processed_flags_cache} = $ret;
85 my ($self, $flag) = @_;
87 return $self->processed_flags()->{$flag};