Roundcube: помогите разобраться в подключаемом модуле «template_container» - PullRequest
0 голосов
/ 14 февраля 2019

Я пытаюсь создать плагин и использовать хук template_container для заполнения контейнера следующим образом:

skins / larry / templates / login.html:

<roundcube:container name="testcontainer" id="testcontainer" />

plugins / myplugin / myplugin.php

class myplugin extends rcube_plugin
{
    function init()
    {
        $this->rcmail = rcmail::get_instance();
        $this->add_hook('template_container', array($this, 'test_hook'));
    }

    function test_hook($attr) {
        if ($attr["name"] === "testcontainer") {
            $content = $attr["content"];
            $content .= html::tag('div', null, "I am testing this");
        }

        return array("content" => $attr["content"]);
    }
}

Я добавил плагин к config.inc.php как

$config['plugins'] = array('xskin', 'managesieve', 'password', 'myplugin');` so that is not the problem.

Но когда я загружаю экран входа в систему, div не отображаетсявверх.Кто-нибудь знает, что я делаю неправильно?

Я также могу сказать, что он работает, когда я использую startup ловушку и $this->api->add_content(html::tag(...), "testcontainer");, поэтому я знаю, что мой плагин работает в целом.

...