{% set inheritedFrom = seomatic.helper.findInheritableBundle(parentBundles, "sitemapAssets", "metaSitemapVars") %}
{% set hasInheritableValues = inheritedFrom is not null %}

{% set additionalVars = {
    'isInherited': seomatic.helper.isInherited(metaSitemapVars, "sitemapAssets"),
    'fieldLabel': "Include Images & Videos in Sitemap"|t("seomatic"),
    'settingName': 'sitemapAssets',
    'labelFor': 'metaSitemapVars-sitemapAssets',
    'overrideNamespace': 'metaSitemapVars'
} %}

{% embed "seomatic/settings/_includes/fields/_inheritableField.twig" with additionalVars %}
    {% macro sitemapAssetsField(metaSitemapVars, suffix) %}
        {% set disabled = suffix|length > 0 %}
        <div class="instructions">
            <p>
                {{ "Whether the URLs to images & videos in Asset fields or Asset fields in matrix blocks should be included in the sitemap"|t("seomatic") }}
            </p>
        </div>

        {% import "_includes/forms" as forms %}
        {% namespace "metaSitemapVars" %}

            {{ forms.lightswitchField({
                id: "sitemapAssets" ~ suffix,
                name: "sitemapAssets",
                on: metaSitemapVars.sitemapAssets,
                warning: false,
                errors: metaSitemapVars.getErrors("sitemapAssets"),
                disabled: disabled,
            }) }}

        {% endnamespace %}
    {% endmacro %}

    {% block inheritedValues %}
        {{ _self.sitemapAssetsField(inheritedFrom.metaSitemapVars ?? metaSitemapVars, "-inherited") }}
    {% endblock %}

    {% block field %}
        {{ _self.sitemapAssetsField(metaSitemapVars) }}
    {% endblock %}
{% endembed %}
