Bug 27673: Replace YAML with YAML::XS
[koha-ffzg.git] / C4 / Utils / DataTables / TablesSettings.pm
index a343944..79c9417 100644 (file)
@@ -2,7 +2,7 @@ package C4::Utils::DataTables::TablesSettings;
 
 use Modern::Perl;
 use List::Util qw( first );
-use YAML;
+use YAML::XS;
 use C4::Context;
 use Koha::Database;
 use Koha::Caches;
@@ -13,7 +13,7 @@ sub get_yaml {
     my $yaml  = $cache->get_from_cache('TablesSettingsYaml');
 
     unless ($yaml) {
-        $yaml = eval { YAML::LoadFile($yml_path) };
+        $yaml = eval { YAML::XS::LoadFile($yml_path) };
         warn "ERROR: the yaml file for DT::TablesSettings is not correctly formatted: $@"
           if $@;
         $cache->set_in_cache( 'TablesSettingsYaml', $yaml, { expiry => 3600 } );
@@ -59,6 +59,22 @@ sub get_columns {
     return $columns;
 }
 
+=head3 get_table_settings
+
+my $settings = C4::Utils::DataTables::TablesSettings::get_table_settings(
+    {
+        module                 => $module,
+        pag                    => $page,
+        tablename              => $tablename,
+    }
+);
+
+Returns the settings for a given table.
+
+The settings are default_display_length and default_sort_order.
+
+=cut
+
 sub get_table_settings {
     my ( $module, $page, $tablename ) = @_;
     my $list = get_yaml;