{% set inheritedFrom = seomatic.helper.findInheritableBundle(parentBundles, "seoImage") %} {% set hasInheritableValues = inheritedFrom is not null %} {% set additionalVars = { 'isInherited': seomatic.helper.isInherited(metaGlobalVars, "seoImage"), 'fieldLabel': "SEO Image Source"|t("seomatic"), 'labelFor': 'metaBundleSettings-seoImageSource', 'wrapperClass': 'seomatic-imageSourceInnerWrapper', 'settingName': 'seoImage' } %} {% embed "seomatic/settings/_includes/fields/_inheritableField.twig" with additionalVars %} {% macro seoImageField(seoImageElements, elementType, imageOptions, assetFieldSources, seomaticConfig, metaBundleSettings, metaGlobalVars, suffix, pageContext) %} {% set disabled = suffix|length > 0 %}

{{ "This is the image that will be used for display as the global website brand, as well as on X (Twitter) Cards and Facebook OpenGraph that link to the website, if they are not specified."|t("seomatic") }}

{% import "_includes/forms" as forms %} {% import 'codeeditor/codeEditor' as codeEditor %} {% namespace "metaBundleSettings" %}
{{ forms.select({ id: "seoImageSource" ~ suffix, name: "seoImageSource", options: imageOptions, value: metaBundleSettings.seoImageSource, class: "seomatic-imageSourceSelect", errors: metaBundleSettings.getErrors("seoImageSource"), disabled: disabled, }) }}
{% endnamespace %} {% if assetFieldSources is defined and assetFieldSources |length %} {% namespace "metaBundleSettings" %}
{{ forms.select({ id: "seoImageField" ~ suffix, name: "seoImageField", options: assetFieldSources, value: metaBundleSettings.seoImageField, errors: metaBundleSettings.getErrors("seoImageField"), disabled: disabled, }) }}
{% endnamespace %} {% endif %} {% namespace "metaBundleSettings" %}
{{ forms.elementSelect({ id: "seoImageIds" ~ suffix, name: "seoImageIds", viewMode: "large", elements: seoImageElements, elementType: elementType, criteria: { kind: ["image"], }, jsClass: 'Craft.AssetSelectInput', selectionLabel: "Select SEO Image"|t("seomatic"), sources: null, limit: 1, warning: false, errors: metaBundleSettings.getErrors("seoImageIds"), disabled: disabled, }) }}
{% endnamespace %} {% namespace "metaGlobalVars" %}
{% if pageContext != "field" %} {{ codeEditor.textField({ id: "seoImage" ~ suffix, name: "seoImage", value: metaGlobalVars.seoImage, warning: false, errors: metaGlobalVars.getErrors("seoImage"), disabled: disabled, }, "SeomaticExpressionField", {}, {wrapperClass: "monaco-editor-background-frame"}) }} {% else %} {{ forms.text({ id: "seoImage" ~ suffix, name: "seoImage", value: metaGlobalVars.seoImage, class: "nicetext", warning: false, errors: metaBundleSettings.getErrors("seoImage"), disabled: disabled, }) }} {% endif %}
{% endnamespace %} {% endmacro %} {% set imageOptions = { fromAsset: "Custom Image"|t("seomatic"), fromUrl: "Custom URL"|t("seomatic"), } %} {% if assetFieldSources is defined and assetFieldSources |length %} {% set imageOptions = { fromField: "From Asset Field"|t("seomatic"), } | merge(imageOptions) %} {% endif %} {% block inheritedValues %} {{ _self.seoImageField(seoImageElements, elementType, imageOptions, assetFieldSources, seomatic.config, inheritedFrom.metaBundleSettings ?? metaBundleSettings, inheritedFrom.metaGlobalVars ?? metaGlobalVars, "-inherited", pageContext) }} {% endblock %} {% block field %} {{ _self.seoImageField(seoImageElements, elementType, imageOptions, assetFieldSources, seomatic.config, metaBundleSettings, metaGlobalVars, "", pageContext) }} {% endblock %} {% endembed %}