Lines 1-4
Link Here
|
1 |
package Koha::Template::Plugin::ColumnsSettings; |
1 |
package Koha::Template::Plugin::TablesSettings; |
2 |
|
2 |
|
3 |
# This file is part of Koha. |
3 |
# This file is part of Koha. |
4 |
# |
4 |
# |
Lines 26-32
use YAML qw( LoadFile );
Link Here
|
26 |
use JSON qw( to_json ); |
26 |
use JSON qw( to_json ); |
27 |
|
27 |
|
28 |
use C4::Context qw( config ); |
28 |
use C4::Context qw( config ); |
29 |
use C4::Utils::DataTables::ColumnsSettings; |
29 |
use C4::Utils::DataTables::TablesSettings; |
30 |
|
30 |
|
31 |
=pod |
31 |
=pod |
32 |
|
32 |
|
Lines 35-43
This plugin allows to get the column configuration for a table.
Link Here
|
35 |
First, include the line '[% USE Tables %]' at the top |
35 |
First, include the line '[% USE Tables %]' at the top |
36 |
of the template to enable the plugin. |
36 |
of the template to enable the plugin. |
37 |
|
37 |
|
38 |
To use, call ColumnsSettings.GetColumns with the module, the page and the table where the template is called. |
38 |
To use, call TablesSettings.GetColumns with the module, the page and the table where the template is called. |
39 |
|
39 |
|
40 |
For example: [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'holdst' ) %] |
40 |
For example: [% TablesSettings.GetColumns( 'circ', 'circulation', 'holdst' ) %] |
41 |
|
41 |
|
42 |
=cut |
42 |
=cut |
43 |
|
43 |
|
Lines 45-51
sub GetColumns {
Link Here
|
45 |
my ( $self, $module, $page, $table, $format ) = @_; |
45 |
my ( $self, $module, $page, $table, $format ) = @_; |
46 |
$format //= q{}; |
46 |
$format //= q{}; |
47 |
|
47 |
|
48 |
my $columns = C4::Utils::DataTables::ColumnsSettings::get_columns( $module, $page, $table ); |
48 |
my $columns = C4::Utils::DataTables::TablesSettings::get_columns( $module, $page, $table ); |
49 |
|
49 |
|
50 |
return $format eq 'json' |
50 |
return $format eq 'json' |
51 |
? to_json( $columns ) |
51 |
? to_json( $columns ) |