return 0;
}
-=head3 api_strings_mapping
+=head3 strings_map
-Retrieves for each column name the unblessed authorised value.
+Returns a map of column name to string representations including the string,
+the mapping type and the mapping category where appropriate.
+
+Currently handles authorised value mappings, library, callnumber and itemtype
+expansions.
+
+Accepts a param hashref where the 'public' key denotes whether we want the public
+or staff client strings.
=cut
-sub api_strings_mapping {
+sub strings_map {
my ( $self, $params ) = @_;
my $columns_info = $self->_result->result_source->columns_info;
my $strings = delete $params->{strings};
# coded values handling
- my $avs = {};
- if ( $strings and $self->can('api_strings_mapping') ) {
- $avs = $self->api_strings_mapping($params);
+ my $string_map = {};
+ if ( $strings and $self->can('strings_map') ) {
+ $string_map = $self->strings_map($params);
}
# Remove forbidden attributes if required (including their coded values)
}
if ($strings) {
- foreach my $field ( keys %{$avs} ) {
- delete $avs->{$field}
+ foreach my $field ( keys %{$string_map} ) {
+ delete $string_map->{$field}
unless any { $_ eq $field } @{ $self->public_read_list };
}
}
# key != undef
$json_object->{$mapped_column} = delete $json_object->{$column};
- $avs->{$mapped_column} = delete $avs->{$column}
- if exists $avs->{$column};
+ $string_map->{$mapped_column} = delete $string_map->{$column}
+ if exists $string_map->{$column};
}
elsif ( exists $json_object->{$column}
# key == undef
delete $json_object->{$column};
- delete $avs->{$column};
+ delete $string_map->{$column};
}
}
}
- $json_object->{_strings} = $avs
+ $json_object->{_strings} = $string_map
if $strings;
if ($embeds) {
return {};
}
-=head3 api_strings_mapping
+=head3 strings_map
my $params = { is_public => 1 };
- my $string_map = $object->api_strings_mapping($params);
+ my $string_map = $object->strings_map($params);
Generic method that returns the string map for coded attributes.
=cut
-sub api_strings_mapping {
+sub strings_map {
return {};
}