View | Details | Raw Unified | Return to bug 35070
Collapse All | Expand All

(-)a/C4/Templates.pm (-2 / +4 lines)
Lines 62-69 sub new { Link Here
62
        push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en';
62
        push @includes, "$htdocs/$_/en/includes" unless $lang eq 'en';
63
    }
63
    }
64
64
65
    my @plugins_include_paths = Koha::Plugins->call( 'template_include_paths',
65
    my @plugins_include_paths = Koha::Plugins->call(
66
        { interface => $interface, lang => $lang } );
66
        'template_include_paths',
67
        { interface => $interface, lang => $lang }
68
    );
67
    push @includes, map { $_ ? @$_ : () } @plugins_include_paths;
69
    push @includes, map { $_ ? @$_ : () } @plugins_include_paths;
68
70
69
    # Do not use template cache if script is called from commandline
71
    # Do not use template cache if script is called from commandline
(-)a/t/db_dependent/Koha/Plugins/TemplateIncludePathHook.t (-8 / +8 lines)
Lines 22-41 use Test::Warn; Link Here
22
22
23
use File::Basename;
23
use File::Basename;
24
24
25
26
BEGIN {
25
BEGIN {
27
    # Mock pluginsdir before loading Plugins module
26
    # Mock pluginsdir before loading Plugins module
28
    my $path = dirname(__FILE__) . '/../../../lib/plugins';
27
    my $path = dirname(__FILE__) . '/../../../lib/plugins';
29
    require t::lib::Mocks;
28
    require t::lib::Mocks;
30
    t::lib::Mocks::mock_config( 'enable_plugins', 1 );
29
    t::lib::Mocks::mock_config( 'enable_plugins', 1 );
31
    t::lib::Mocks::mock_config( 'pluginsdir', $path );
30
    t::lib::Mocks::mock_config( 'pluginsdir',     $path );
32
31
33
    use_ok('Koha::Plugins');
32
    use_ok('Koha::Plugins');
34
    use_ok('Koha::Plugins::Handler');
33
    use_ok('Koha::Plugins::Handler');
35
    use_ok('Koha::Plugin::Test');
34
    use_ok('Koha::Plugin::Test');
36
}
35
}
37
36
38
my $schema  = Koha::Database->new->schema;
37
my $schema = Koha::Database->new->schema;
39
38
40
subtest 'template_include_paths' => sub {
39
subtest 'template_include_paths' => sub {
41
    plan tests => 1;
40
    plan tests => 1;
Lines 46-57 subtest 'template_include_paths' => sub { Link Here
46
    Koha::Plugin::Test->new->enable;
45
    Koha::Plugin::Test->new->enable;
47
46
48
    require C4::Templates;
47
    require C4::Templates;
49
    my $c4_template = C4::Templates::gettemplate('intranet-main.tt', 'intranet');
48
    my $c4_template = C4::Templates::gettemplate( 'intranet-main.tt', 'intranet' );
50
    my $template = $c4_template->{TEMPLATE};
49
    my $template    = $c4_template->{TEMPLATE};
51
    my $output = '';
50
    my $output      = '';
52
    $template->process(\"[% INCLUDE test.inc %]", {}, \$output) || die $template->error();
51
    $template->process( \"[% INCLUDE test.inc %]", {}, \$output ) || die $template->error();
53
    is($output, 'included content');
52
    is( $output, 'included content' );
54
53
55
    $schema->storage->txn_commit;
54
    $schema->storage->txn_commit;
55
56
    #Koha::Plugins::Methods->delete;
56
    #Koha::Plugins::Methods->delete;
57
};
57
};
(-)a/t/lib/plugins/Koha/Plugin/Test/inc/test.inc (-2 / +1 lines)
Line 1 Link Here
1
[% 'included content' ~%]
1
[% 'included content' | html ~%]
2
- 

Return to bug 35070