Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow prefix and postfix text on relationships and taxonomies input field #2990

Merged
merged 11 commits into from
Dec 2, 2021
Merged
14 changes: 14 additions & 0 deletions templates/content/_relationships.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@
{% set options = related_options(contentType, relation.order|default(), relation.format|default(), relation.required) %}
{% set value = record|related_values(contentType) %}

{# Set the prefix and postfix attributes #}
{% set prefix = prefix|default(relation['prefix']|default) %}
{% if prefix and not (prefix starts with '<p' or prefix starts with '<span' or prefix starts with '<div') %}
{% set prefix = '<div id="' ~ contentType ~ '_prefix" class="form--helper">' ~ prefix|markdown ~ '</div>' %}
{% endif %}

{% set postfix = postfix|default(relation['postfix']|default) %}
{% if postfix and not (postfix starts with '<p' or postfix starts with '<span' or postfix starts with '<div') %}
{% set postfix = '<div id="' ~ contentType ~ '_postfix" class="form--helper">' ~ postfix|markdown ~ '</div>' %}
{% endif %}

<div class="form-group is-normal">
{{ prefix|raw }}

{% include '@bolt/_partials/fields/_label.html.twig' with {
'id': 'relationship-' ~ contentType,
Expand All @@ -25,6 +37,8 @@
></editor-select>
</div>

{{ postfix|raw }}

</div>

{% endfor %}
Expand Down
15 changes: 15 additions & 0 deletions templates/content/_taxonomies.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@

{% set options = taxonomy_options(definition) %}
{% set value = taxonomy_values(record.taxonomies, definition) %}

{# Set the prefix and postfix attributes #}
{% set prefix = prefix|default(definition['prefix']|default) %}
{% if prefix and not (prefix starts with '<p' or prefix starts with '<span' or prefix starts with '<div') %}
{% set prefix = '<div id="' ~ taxonomy ~ '_prefix" class="form--helper">' ~ prefix|markdown ~ '</div>' %}
{% endif %}

{% set postfix = postfix|default(definition['postfix']|default) %}
{% if postfix and not (postfix starts with '<p' or postfix starts with '<span' or postfix starts with '<div') %}
{% set postfix = '<div id="' ~ taxonomy ~ '_postfix" class="form--helper">' ~ postfix|markdown ~ '</div>' %}
{% endif %}

<div class="form-group is-normal">

{{ prefix|raw }}

{% include '@bolt/_partials/fields/_label.html.twig' with {
'id': 'taxonomy-' ~ definition.slug,
'label': definition.name,
Expand All @@ -26,6 +39,8 @@
></editor-select>
</div>

{{ postfix|raw }}

</div>

{% endif %}
Expand Down