モジュールでウィジェットを拡張できます。
そのためには、元のウィジェットが定義されているモジュールにモジュールを依存させる必要があります(module.xmlのシーケンスを参照)。
次に、etcディレクトリにwidget.xmlを作成します。
重要なのは、widget.xsdを使用しないことです(拡張に必要のない多くのフィールドが必要です)が、widget_file.xsdです。
以下は、静的ブロックウィジェットにテンプレートを追加する例です。
<?xml version="1.0" encoding="UTF-8"?>
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget_file.xsd">
    <widget id="cms_static_block">
        <parameters>
            <parameter name="template" xsi:type="select">
                <options>
                    <option name="option_id" value="Your_Module::view/form.phtml">
                        <label translate="true">Your Template</label>
                    </option>
                </options>
            </parameter>
        </parameters>
    </widget>
</widgets>
これは、特定のコンテナーのテンプレートを許可するためのコンテナー構成の別の例です。
<?xml version="1.0" encoding="UTF-8"?>
<widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget_file.xsd">
    <widget id="products_list">
        <parameters>
            <parameter name="template" xsi:type="select">
                <options>
                    <option name="slider" value="Vendor_Module::product/widget/content/slider.phtml">
                        <label translate="true">Products Slider Template</label>
                    </option>
                </options>
            </parameter>
        </parameters>
        <containers>
            <container name="content">
                <template name="slider" value="slider" />
            </container>
            <container name="content.top">
                <template name="slider" value="slider" />
            </container>
            <container name="content.bottom">
                <template name="slider" value="slider" />
            </container>
        </containers>
    </widget>
</widgets>
               
              
Invalid Document Element 'label': This element is not expected. Line: 34ますそして、そのウィジェットにテンプレートを含めるようにソリューションを実装しますか?私と同じエラーが出るかもしれません。もしそうなら、私はgithubに問題を提出します。少なくとも、私が何か間違ったことをしていることがわかるでしょう。