๐Ÿ‡ซ๐Ÿ‡ทFrance @webmestre

Account created on 30 December 2005, over 18 years ago
#

Recent comments

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

webmestre โ†’ created an issue.

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Hello,

thanks again for helping.

I couldn't make your code work.

The solution I found to be the best is to change the 'taxonomy_term' view:

  • I cloned it
  • I used the header parameters inside the footer parameters
  • then the referencing entities are not display 'before' but 'bellow' the term custom fields.

Not the best...

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

I thank you to help to find a solution. But it doesn't work. The display remains the same.

More info:

  • the node that references the taxonomie term has 'field_etat' for machin name. 'field_etat' doesn't belong to the term but to a custom content type.
  • the taxonomy term has only 2 fields:
    • 'description' = genuine text field
    • 'field_map' = a custom field i created
๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

I finally decided to set my custom menu block next to the "Branding" block. Instead of inside the "Main menu" region.

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Hello,
I decided to manually create a new sub-theme. It works now.
Impossible to know what was the reason of the issue.
I clode this ticket.

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

@hutuhay
what is the base file?

  • node.html.twig?
  • html.html.twig?
๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

I'm sorry, I don't understand what I have to do.
Is it a path I can manage by SSH, SFTP...?
Where is inside a debian config?

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Hi adityarawat_ln & arnested

this module is very good.
I also noticed it solves by itself a problem we can face in displaying decimal numbers like integers.
This module Human Decimal โ†’ does that. But only that.

Number Fomatter โ†’ is really richer. Congrats!

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Hi,

could you explain where do I have to use this code?

export COMPOSER_ROOT_VERSION=1.0.0
๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

I'm experiencing the same issues on different hosts.

composer update -vvv

had no effect. :(

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Hi benabaird,
I guess this module is easier to manage by a dev than by a builder.
Tell me if you build a UI.

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Hello BookerE1 โ†’ ,

thanks for helping.
Does it work in a 'field.html.twig' file template?

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Here's a field template that makes the job:


{%
  set classes = [
    'field',
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
  ]
%}
{%
  set title_classes = [
    'field__label',
    label_display == 'visually_hidden' ? 'visually-hidden' : '',
  ]
%}

{# get prefix and suffix #}
{% set prefix = element['#items'].getFieldDefinition().getSetting('prefix') ?? '' %}
{% set suffix = element['#items'].getFieldDefinition().getSetting('suffix') ?? '' %}

{# display the field #}
<div{{ attributes.addClass(classes) }}>
  <div{{ title_attributes.addClass(title_classes) }}>{{ element['#title'] }}</div>
  {% if multiple %}
    <div class='field__items'>
  {% endif %}
  {% for item in items %}
    <span>{{ prefix }} </span>
    <span{{ item.attributes.addClass('field__item') }}>{{ item.content }}</span>
    <span> {{ suffix }}</span>
  {% endfor %}
  {% if multiple %}
    </div>
  {% endif %}
</div>

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

This field template works:


{%
  set classes = [
    'field',
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
  ]
%}
{%
  set title_classes = [
    'field__label',
    label_display == 'visually_hidden' ? 'visually-hidden' : '',
  ]
%}

{# get prefix and suffix #}
{% set prefix = element['#items'].getFieldDefinition().getSetting('prefix') ?? '' %}
{% set suffix = element['#items'].getFieldDefinition().getSetting('suffix') ?? '' %}

{# display the field #}
<div{{ attributes.addClass(classes) }}>
  <div{{ title_attributes.addClass(title_classes) }}>{{ element['#title'] }}</div>
  {% if multiple %}
    <div class='field__items'>
  {% endif %}
  {% for item in items %}
    <span>{{ prefix }} </span>
    <span{{ item.attributes.addClass('field__item') }}>{{ item.content }}</span>
    <span> {{ suffix }}</span>
  {% endfor %}
  {% if multiple %}
    </div>
  {% endif %}
</div>

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre
{%
  set classes = [
    'field',
    'field--name-' ~ field_name|clean_class,
    'field--type-' ~ field_type|clean_class,
    'field--label-' ~ label_display,
  ]
%}
{%
  set title_classes = [
    'field__label',
    label_display == 'visually_hidden' ? 'visually-hidden' : '',
  ]
%}

{# get prefix and suffix #}
{% set prefix = element['#items'].getFieldDefinition().getSetting('prefix') ?? '' %}
{% set suffix = element['#items'].getFieldDefinition().getSetting('suffix') ?? '' %}

{# display the field #}
<div{{ attributes.addClass(classes) }}>
  <div{{ title_attributes.addClass(title_classes) }}>{{ element['#title'] }}</div>
  {% if multiple %}
    <div class='field__items'>
  {% endif %}
  {% for item in items %}
    <span>{{ prefix }} </span>
    <span{{ item.attributes.addClass('field__item') }}>{{ item.content }}</span>
    <span> {{ suffix }}</span>
  {% endfor %}
  {% if multiple %}
    </div>
  {% endif %}
</div>
๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Hi,
I'm experiencing the same issue with openai 1.0@beta version.

Is there a way to fix it?

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Thanks to be so reactive.
Please change information about different updates that mentionne: ยซ Works with Drupal: ^8 || ^9 || ^10 ยป while it's not true.
I.e.: https://www.drupal.org/project/date_range_formatter/releases/9.0.x-dev โ†’

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Hi JordiTR โ†’ ,
I own a D8 version that was supposed to be released here. I'm not able to do that by myself.
Instead of working on D8, won't it be more clever to restart a D10 version, with new features?

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

webmestre โ†’ created an issue.

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

wombatbuddy โ†’

your code works very fine.

Thanks for helping so efficiently.

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Hi,

thanks for helping. I'm perhaps not clear enough in naming elements. Sorry.

Here is the detailed test config:

* Content type: system name = mycontenttype
    * Field that should display the SVG file in this content type: system name = field_myparagraphinnode
        * Entity reference revisions
        * Reference type: Paragraph
        * Paragraph type: myparagraph
        * NB: display
            * default
                * format: rendered entity
                * displayed as default
* Paragraph: system name = myparagraph
    * fields in this paragraph:
        * field_mysvginparagraph
            * field type:
                * reference to an entity
                * reference type: Media
                * Media type: Vector Image
                * display:
                    * format: rendered entity
                    * displayed as default
        * field_mytextinparagraph
            * dummy text field to check if the paragraph works

QUESTION:
With the code you kindly provided

{% for paragraph in node.field_myparagraph %}
  {% if not paragraph.entity.field_svg.isempty %} โ€ฆ

What kind of custom template has to be used to display the SVG file? Field? Paragraph? Node?

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

wombatbuddy โ†’ 's code cannot display the SVG file.

In the template function, lines

  $variables['svg_width'] = $formatter_settings['width'];
  $variables['svg_height'] = $formatter_settings['height'];

I get this error message:
Warning: Undefined array key "width"
Same for Height

If I use the code and I fill the variables by hand (svg path, height, width...) it works fine.
That means yhe function and the code cannot retrieve the information inside the Media Library.

In this discussion I (almost) understand the function for extracting from Media Library is different:
https://www.drupal.org/forum/support/module-development-and-code-questio... โ†’

In any case, thnks for helping!

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

wombatbuddy, your code works very fine.
Thanks for helping. It was really too complicate for me.

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre
          {% set number_suffix = paragraph.entity.field_first.getSetting('suffix') %}
            <div class="myparagraph">
              {{ paragraph.entity.field_first.value }} {{ number_suffix }}
              {{ paragraph.entity.field_second.value }}
            </div>

That's the way I just found to display the "suffix".
PROBLEM: singular and plural are not managed. Both are displayed: "3 night | nights in a tent". :(

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

Example of 1 paragraph:

  • field_first value: "3"
  • field_first suffix: "night|nights"
  • field_second value: in a tent

The goal is to get the display

  • <div>3 nights in a tent</div> with a custom twig code
  • while the standard display is <div>3 nights</div><div>in a ten</div>

If wombatbuddy has a better strategy, I'm open. I'm a Twig beginner.

๐Ÿ‡ซ๐Ÿ‡ทFrance webmestre

On Drupal 10.1.5, the drag'n drop works.
BUT the created structure is unstable.

Production build 0.69.0 2024