「imageType」という名前のcomplexTypeをカスタム画像タイプで拡張する
現在開発中のモジュールの目標は、「opengraph_image」と呼ばれるカスタム画像タイプを追加することです。正常に動作するInstallData.phpスクリプトを使用して、新しいEAV属性を追加しました。Magento2バックエンドにログインして製品を変更すると、製品画像のアップロードまたは編集中に画像タイプ「opengraph_image」を選択できます。 ただし、フロントエンドでは、この画像を表示したいと思います。したがって、次のコンテンツを使用して、モジュールにetc / view.xmlファイルを作成しました。 <?xml version="1.0"?> <view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Esites_SEO:etc/custom.xsd"> <media> <images module="Magento_Catalog"> <image id="opengraph_image" type="opengraph_image"> <width>265</width> <height>265</height> </image> </images> </media> </view> しかし、今私は次のエラーを受け取ります: Invalid XML in file /var/www/html/vhosts/magento2/app/code/Esites/SEO/etc/view.xml: Element 'image', attribute 'type': [facet 'enumeration'] The value 'opengraph_image' is not an element of the set {'thumbnail', 'small_image', 'image', 'swatch_image', 'swatch_thumb'}. Line: 5 …