web-dev-qa-db-ja.com

プラグインのインストール後のカスタムメッセージ

インストールプロセスの後、sys.ini-fileの翻訳されたマニフェストの説明がExtension Managerに表示されます。残念ながら、このテキストは(公開された)プラグインパラメータの編集中にも表示されます。

/ plugins/system/my_plugin/manifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" version="3.8" group="system" method="upgrade">
<name>PLG_NAME</name>
<description>PLG_DESCRIPTION</description>

/ plugins/system/my_plugin/language/en-GB/en-GB.plg_system_my_plugin.sys.ini

PLG_DESCRIPTION="This text is shown after installation AND as description of enabled plugins"

Extension Managerでのインストール/更新後にカスタムメッセージを表示することは可能ですか?そして、この時点でのみ。

前もって感謝します!

4
sbruemmer

はい、それは絶対に可能です。インストールを作成/使用する必要がありますscript.phpインストール可能プラグインフォルダー内のファイルには、インストール、アンインストール、更新、プリフライトまたはポストフライトタスクのさまざまなポイントのタスクが含まれます。

モジュールの場合、スクリプトクラスは次のようになります。

class mod_helloWorldInstallerScript
{

    public function __construct(JAdapterInstance $adapter) 
    {
        // construct here... it could be left empty
    }

    /*
    install, update, preflight... functions here
    */

    /**
    * Called on installation        
    */
    public function install(JAdapterInstance $adapter)
    {
        echo 'Your custom message on installation';
    }

    // In this function you can also display your custom message in
    // the Extension Manager after install ie.     
    function postflight($type, $parent) 
    {
        echo '<p>Anything here happens after the installation/update/uninstallation of the module</p>';
        echo JText::_('PLG_MY_CUSTOM_TEXT_AFTER_INSTALL');
    }

}

プラグインについても同じですが、クラスを呼び出す点が異なります:plg_mypluginInstallerScript

このテーマについては、こちらで詳しく学習できます: https://docs.joomla.org/J3.x:Creating_a_simple_module/Adding_an_install-uninstall-update_script_file

または、このページの下部にある https://docs.joomla.org/Manifest_files

5
Zollie