Problem/Motivation

The template of the block contains some logic that can be moved to .module file

 {% set safe_hash = configuration['block_revision_id'] ~ '--' ~ loop.index %}
                {# Setup our image style. #}
                {% set media_image = ''%}
                {% set image_desktop = ''%}
                {% if item.field_media.entity.field_media_image.entity.uri.value %}
                  {% set media_image = item.field_media.entity.field_media_image.entity.uri.value %}
                  {% set image_alt = item.field_media.entity.field_media_image.0.alt %}
                {% endif %}

                {% if media_image %}

Proposed resolution

Move that logic to the .module file directly.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aleevas created an issue. See original summary.

rolki’s picture

Status: Active » Reviewed & tested by the community

LGTM!

  • aleevas committed f2450eb0 on 1.0.x
    Issue #3477401: Move some logic from template file to .module file